Skip to content

Commit bf18163

Browse files
authored
Merge pull request #11 from pnhowe/master
version 0.9.11
2 parents 0724640 + c162845 commit bf18163

5 files changed

Lines changed: 30 additions & 14 deletions

File tree

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
1+
DISTRO := $(shell lsb_release -si | tr A-Z a-z)
2+
DISTRO_MAJOR_VERSION := $(shell lsb_release -sr | cut -d. -f1)
3+
DISTRO_NAME := $(shell lsb_release -sc | tr A-Z a-z)
4+
15
all:
26
./setup.py build
37

48
install:
9+
ifeq (ubuntu, $(DISTRO))
510
./setup.py install --root $(DESTDIR) --install-purelib=/usr/lib/python3/dist-packages/ --prefix=/usr --no-compile -O0
11+
else
12+
./setup.py install --root $(DESTDIR) --prefix=/usr --no-compile -O0
13+
endif
614

715
clean:
816
./setup.py clean
917
$(RM) -fr build
1018
$(RM) -f dpkg
1119
$(RM) -f rpm
20+
ifeq (ubuntu, $(DISTRO))
1221
dh_clean || true
22+
endif
1323

1424
dist-clean: clean
1525
$(RM) -fr debian
@@ -59,7 +69,7 @@ rpm-distros:
5969
echo centos-6
6070

6171
rpm-requires:
62-
echo rpm-build
72+
echo python34 rpm-build
6373

6474
rpm-setup:
6575
./rpmbuild-setup

cinp/server_common.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from dateutil import parser as datetimeparser
21
import traceback
32
import json
3+
import copy
4+
from dateutil import parser as datetimeparser
45
from urllib import parse
56

67
from cinp.common import URI
@@ -66,9 +67,9 @@ def _dictConverter( value ):
6667

6768
MAP_TYPE_CONVERTER = {
6869
'NoneType': lambda a: None,
69-
'str': str,
70-
'int': str,
71-
'float': str,
70+
'str': lambda a: a,
71+
'int': lambda a: a,
72+
'float': lambda a: a,
7273
'bool': lambda a: True if a else False,
7374
'datetime': lambda a: a.isoformat(),
7475
'timedelta': lambda a: a.total_seconds(),
@@ -249,7 +250,7 @@ def _fromPython( self, paramater, python_value ):
249250
if not isinstance( python_value, dict ):
250251
raise ValueError( 'Map must be dict' )
251252

252-
result = python_value.copy()
253+
result = copy.deepcopy( python_value )
253254
_fromPythonMap( result )
254255

255256
return result
@@ -595,11 +596,11 @@ def _asDict( self, converter, target_object ): # yes this is a bit of a hack, w
595596
result = {}
596597
for field_name in self.field_map:
597598
try:
598-
result[ field_name ] = converter.fromPython( self.field_map[ field_name ], getattr( target_object, field_name ) ) # TODO: disguinsh between the AttributeError oflooking up the field, and any errors pulling the field value might cause
599+
result[ field_name ] = converter.fromPython( self.field_map[ field_name ], getattr( target_object, field_name ) ) # TODO: disguinsh between the AttributeError of looking up the field, and any errors pulling the field value might cause
599600
except ValueError as e:
600601
raise ValueError( 'Error with "{0}": "{1}"'.format( field_name, str( e ) ) )
601602
except AttributeError:
602-
raise ServerError( 'target_object missing field "{0}"'.format( field_name ) ) # yes, internal server error, target_object comes from inside the house
603+
raise ServerError( 'target_object("{0}") missing field "{1}"'.format( target_object.__class__.__name__, field_name ) ) # yes, internal server error, target_object comes from inside the house
603604

604605
return result
605606

@@ -712,10 +713,10 @@ def create( self, converter, transaction, data ):
712713
error_map[ field_name ] = 'Invalid Value "{0}"'.format( str( e ) )
713714

714715
except KeyError:
715-
if field.required:
716-
error_map[ field_name ] = 'Required Field'
717-
else:
716+
if field.default is not None:
718717
value_map[ field_name ] = field.default
718+
elif field.required:
719+
error_map[ field_name ] = 'Required Field'
719720

720721
if error_map != {}:
721722
raise InvalidRequest( data=error_map )

debian-common/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
cinp (0.9.11-1) DIST; urgency=medium
2+
3+
* Bug fixes
4+
5+
-- Peter <peter@xps13-01> Wed, 17 Oct 2018 15:55:56 -0600
6+
17
cinp (0.9.9-1) DIST; urgency=medium
28

39
* django model resolver update

rpmbuild-setup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Version: $VERSION
2828
Release: $RELEASE.$DISTRO_RELEASE
2929
License: Apache2
3030
Group: multiverse/python
31-
Requires: python3
31+
Requires: python34
3232
BuildArch: noarch
3333
3434
%description

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import os
44
from distutils.core import setup
55
from distutils.command.build_py import build_py
6-
# import setuptools # so we have develop mode
76

87

98
class build( build_py ):
@@ -21,7 +20,7 @@ def run( self ):
2120

2221

2322
setup( name='cinp',
24-
version='0.9.9',
23+
version='0.9.11',
2524
description='CInP, Concise Interaction Protocol',
2625
long_description="""A HTTP/JSON Protocol that brings some of the
2726
flexability of REST, but extends beyond CRUD to support Metod Calling and

0 commit comments

Comments
 (0)