Skip to content

Commit

Permalink
better handle dexterity
Browse files Browse the repository at this point in the history
  • Loading branch information
thet committed Feb 27, 2015
1 parent 23ecdc3 commit 1362e54
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions collective/jsonify/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def get_dexterity_fields(self):
from plone.dexterity.utils import iterSchemata
# from plone.uuid.interfaces import IUUID
from zope.schema import getFieldsInOrder
from datetime import datetime
from datetime import date
from plone.directives import form

if not form.Schema.providedBy(self.context):
Expand Down Expand Up @@ -482,15 +482,15 @@ def get_dexterity_fields(self):
}
value = dvalue

elif field_type in ('DateTime',):
if isinstance(value, basestring):
value = datetime.strptime(value, '%Y-%m-%d')
if isinstance(value, datetime):
value = value.date()
if isinstance(value, date):
value = value.isoformat()

# elif field_type in ('TextLine',):
else:
BASIC_TYPES = (unicode, int, long, float, bool, type(None))
BASIC_TYPES = (
unicode, int, long, float, bool, type(None),
list, tuple, dict
)
if type(value) in BASIC_TYPES:
pass
elif field is not None:
Expand Down

0 comments on commit 1362e54

Please sign in to comment.