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

Commit

Permalink
Merge pull request #20 from plone/save-data
Browse files Browse the repository at this point in the history
actually save data
  • Loading branch information
bloodbare committed Nov 21, 2016
2 parents 2c2c3d9 + 30d46b1 commit 0346f7b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/plone.server/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
1.0a6 (unreleased)
------------------

- Nothing changed yet.
- Fix issue where you could not save data with the API
[vangheem]


1.0a5 (2016-11-21)
Expand All @@ -12,4 +13,4 @@


1.0a4 (2016-11-19)
------------------
------------------
1 change: 1 addition & 0 deletions src/plone.server/plone/server/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ class Resource(Persistent):
uuid = None
creation_date = None
modification_date = None
title = None

def __init__(self, id=None):
if id is not None:
Expand Down
14 changes: 8 additions & 6 deletions src/plone.server/plone/server/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ def registerInterface(interface, omit=(), prefix=None):
class IResource(IContained):
portal_type = schema.TextLine()

title = schema.TextLine(
title='Title',
required=False,
description=u"Title of the Site",
default=u''
)


class IResourceFactory(IFactory):

Expand Down Expand Up @@ -102,12 +109,7 @@ class IResourceFactory(IFactory):


class ISite(IResource, IZopeSite):
title = schema.TextLine(
title='Title',
required=False,
description=u"Title of the Site",
default=u''
)
pass


class IItem(IResource):
Expand Down
2 changes: 1 addition & 1 deletion src/plone.server/plone/server/json/deserialize_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def set_schema(
errors.append({
'message': e.doc(), 'field': name, 'error': e})
else:
setattr(schema, name, value)
setattr(obj, name, value)
if validate_all:
validation = getValidationErrors(schema, schema(self.context))

Expand Down
3 changes: 3 additions & 0 deletions src/plone.server/plone/server/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ def test_create_contenttype(self):
})
)
self.assertTrue(resp.status_code == 201)
root = self.layer.new_root()
obj = root['plone']['item1']
self.assertEqual(obj.title, 'Item1')

def test_create_delete_contenttype(self):
"""Create and delete a content type."""
Expand Down

0 comments on commit 0346f7b

Please sign in to comment.