Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
DISTRO := $(shell lsb_release -si | tr A-Z a-z)
DISTRO_MAJOR_VERSION := $(shell lsb_release -sr | cut -d. -f1)
DISTRO_NAME := $(shell lsb_release -sc | tr A-Z a-z)

all:
./setup.py build

install:
ifeq (ubuntu, $(DISTRO))
./setup.py install --root $(DESTDIR) --install-purelib=/usr/lib/python3/dist-packages/ --prefix=/usr --no-compile -O0
else
./setup.py install --root $(DESTDIR) --prefix=/usr --no-compile -O0
endif

clean:
./setup.py clean
$(RM) -fr build
$(RM) -f dpkg
$(RM) -f rpm
ifeq (ubuntu, $(DISTRO))
dh_clean || true
endif

dist-clean: clean
$(RM) -fr debian
Expand Down Expand Up @@ -59,7 +69,7 @@ rpm-distros:
echo centos-6

rpm-requires:
echo rpm-build
echo python34 rpm-build

rpm-setup:
./rpmbuild-setup
Expand Down
21 changes: 11 additions & 10 deletions cinp/server_common.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from dateutil import parser as datetimeparser
import traceback
import json
import copy
from dateutil import parser as datetimeparser
from urllib import parse

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

MAP_TYPE_CONVERTER = {
'NoneType': lambda a: None,
'str': str,
'int': str,
'float': str,
'str': lambda a: a,
'int': lambda a: a,
'float': lambda a: a,
'bool': lambda a: True if a else False,
'datetime': lambda a: a.isoformat(),
'timedelta': lambda a: a.total_seconds(),
Expand Down Expand Up @@ -249,7 +250,7 @@ def _fromPython( self, paramater, python_value ):
if not isinstance( python_value, dict ):
raise ValueError( 'Map must be dict' )

result = python_value.copy()
result = copy.deepcopy( python_value )
_fromPythonMap( result )

return result
Expand Down Expand Up @@ -595,11 +596,11 @@ def _asDict( self, converter, target_object ): # yes this is a bit of a hack, w
result = {}
for field_name in self.field_map:
try:
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
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
except ValueError as e:
raise ValueError( 'Error with "{0}": "{1}"'.format( field_name, str( e ) ) )
except AttributeError:
raise ServerError( 'target_object missing field "{0}"'.format( field_name ) ) # yes, internal server error, target_object comes from inside the house
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

return result

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

except KeyError:
if field.required:
error_map[ field_name ] = 'Required Field'
else:
if field.default is not None:
value_map[ field_name ] = field.default
elif field.required:
error_map[ field_name ] = 'Required Field'

if error_map != {}:
raise InvalidRequest( data=error_map )
Expand Down
6 changes: 6 additions & 0 deletions debian-common/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
cinp (0.9.11-1) DIST; urgency=medium

* Bug fixes

-- Peter <peter@xps13-01> Wed, 17 Oct 2018 15:55:56 -0600

cinp (0.9.9-1) DIST; urgency=medium

* django model resolver update
Expand Down
2 changes: 1 addition & 1 deletion rpmbuild-setup
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Version: $VERSION
Release: $RELEASE.$DISTRO_RELEASE
License: Apache2
Group: multiverse/python
Requires: python3
Requires: python34
BuildArch: noarch

%description
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os
from distutils.core import setup
from distutils.command.build_py import build_py
# import setuptools # so we have develop mode


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


setup( name='cinp',
version='0.9.9',
version='0.9.11',
description='CInP, Concise Interaction Protocol',
long_description="""A HTTP/JSON Protocol that brings some of the
flexability of REST, but extends beyond CRUD to support Metod Calling and
Expand Down