Skip to content
This repository was archived by the owner on Sep 15, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions jsonmapper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ class DateTimeField(Field):
def _to_python(self, value):
if isinstance(value, basestring):
try:
value = value.split('.', 1)[0] # strip out microseconds
value = value.rstrip('Z') # remove timezone separator
value = value.split('.', 1)[0] # strip out microseconds
value = value.rstrip('Z') # remove timezone separator
value = datetime(*strptime(value, '%Y-%m-%dT%H:%M:%S')[:6])
except ValueError:
raise ValueError('Invalid ISO date/time %r' % value)
Expand Down Expand Up @@ -281,7 +281,7 @@ class TimeField(Field):
def _to_python(self, value):
if isinstance(value, basestring):
try:
value = value.split('.', 1)[0] # strip out microseconds
value = value.split('.', 1)[0] # strip out microseconds
value = time(*strptime(value, '%H:%M:%S')[3:6])
except ValueError:
raise ValueError('Invalid ISO time %r' % value)
Expand Down Expand Up @@ -386,7 +386,7 @@ def _to_json(self, value):
break
else:
# FIXME better error message
raise ValueError('Unknown value type')
raise ValueError('Unknown value type')
else:
value_type = value[self.type_key]
mapping = self.mappings[value_type]
Expand Down Expand Up @@ -442,7 +442,6 @@ def _to_python(self, value):
def _to_json(self, value):
return [self.field._to_json(item) for item in value]


class Proxy(list):

def __init__(self, list, field):
Expand Down
18 changes: 9 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@


setup(
name = 'JSONMapper',
version = '0.1',
description = 'Python JSON mapper',
long_description = '',
author = 'Matt Good',
author_email = '[email protected]',
license = 'BSD',
url = '',
packages = ['jsonmapper'],
name='JSONMapper',
version='0.1',
description='Python JSON mapper',
long_description='',
author='Matt Good',
author_email='[email protected]',
license='BSD',
url='',
packages=['jsonmapper'],
)