Skip to content
This repository has been archived by the owner on Apr 9, 2023. It is now read-only.

Commit

Permalink
Enable to serialize the api definition
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramon Navarro Bosch committed Jan 17, 2017
1 parent 8a1de97 commit 93d63b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/plone.server/plone/server/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def load_services(_context, module_name):
if service_conf.get('name', False):
if 'endpoints' not in ct_api:
ct_api['endpoints'] = OrderedDict()
ct_api['endpoints'][service_conf.get('method', 'GET')] = \
ct_api['endpoints'][service_conf.get('name')] = \
OrderedDict(service_conf)
else:
ct_api[service_conf.get('method', 'GET')] = OrderedDict(service_conf)
Expand Down
9 changes: 7 additions & 2 deletions src/plone.server/plone/server/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from zope.interface import implementer
# JSON Decoder
from zope.securitypolicy.settings import PermissionSetting
from zope.interface.interface import InterfaceClass

import json

Expand All @@ -24,8 +25,12 @@ class PServerJSONEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, complex):
return [obj.real, obj.imag]
if isinstance(obj, datetime):
return obj.isoformat()
elif isinstance(obj, datetime):
return obj.isoformat()
elif isinstance(obj, type):
return obj.__module__ + '.' + obj.__name__
elif isinstance(obj, InterfaceClass):
return [x.__module__ + '.' + x.__name__ for x in obj.__iro__] # noqa
try:
iterable = iter(obj)
except TypeError:
Expand Down

0 comments on commit 93d63b5

Please sign in to comment.