Skip to content

Commit

Permalink
Merge branch 'master' into fix-datetime-deserialization
Browse files Browse the repository at this point in the history
  • Loading branch information
tisto committed Nov 3, 2017
2 parents e559c10 + 69cb957 commit 914367a
Show file tree
Hide file tree
Showing 17 changed files with 36 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ Changelog
This fixes https://github.com/plone/plone.restapi/issues/253
[buchi]

- Update pytz to fix travis builds
[sneridagh]

- Reading a Resource with GET should include is_folderish (#327)
[sneridagh]


1.0a21 (2017-09-23)
-------------------
Expand Down
1 change: 1 addition & 0 deletions docs/source/_json/collection.resp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Content-Type: application/json
"exclude_from_nav": false,
"expires": null,
"id": "collection",
"is_folderish": false,
"item_count": 30,
"items": [
{
Expand Down
1 change: 1 addition & 0 deletions docs/source/_json/content_get.resp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Content-Type: application/json
"exclude_from_nav": false,
"expires": null,
"id": "my-document",
"is_folderish": false,
"language": "",
"layout": "document_view",
"modified": "2016-10-21T19:00:00+00:00",
Expand Down
1 change: 1 addition & 0 deletions docs/source/_json/content_post.resp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Location: http://localhost:55001/plone/folder/my-document
"exclude_from_nav": false,
"expires": null,
"id": "my-document",
"is_folderish": false,
"language": "",
"layout": "document_view",
"modified": "2016-10-21T19:00:00+00:00",
Expand Down
1 change: 1 addition & 0 deletions docs/source/_json/document.resp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Content-Type: application/json
"exclude_from_nav": false,
"expires": null,
"id": "front-page",
"is_folderish": false,
"language": "",
"layout": "document_view",
"modified": "2016-01-21T01:24:11+00:00",
Expand Down
1 change: 1 addition & 0 deletions docs/source/_json/event.resp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Content-Type: application/json
"exclude_from_nav": false,
"expires": null,
"id": "event",
"is_folderish": false,
"language": "",
"layout": "event_view",
"location": null,
Expand Down
1 change: 1 addition & 0 deletions docs/source/_json/expansion.resp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Content-Type: application/json
"exclude_from_nav": false,
"expires": null,
"id": "front-page",
"is_folderish": false,
"language": "",
"layout": "document_view",
"modified": "2016-01-21T01:24:11+00:00",
Expand Down
1 change: 1 addition & 0 deletions docs/source/_json/expansion_expanded.resp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Content-Type: application/json
"exclude_from_nav": false,
"expires": null,
"id": "front-page",
"is_folderish": false,
"language": "",
"layout": "document_view",
"modified": "2016-01-21T01:24:11+00:00",
Expand Down
1 change: 1 addition & 0 deletions docs/source/_json/expansion_expanded_full.resp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Content-Type: application/json
"exclude_from_nav": false,
"expires": null,
"id": "front-page",
"is_folderish": false,
"language": "",
"layout": "document_view",
"modified": "2016-01-21T01:24:11+00:00",
Expand Down
1 change: 1 addition & 0 deletions docs/source/_json/file.resp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Content-Type: application/json
"size": 74429
},
"id": "file",
"is_folderish": false,
"language": "",
"layout": "file_view",
"modified": "2016-01-21T05:24:11+00:00",
Expand Down
1 change: 1 addition & 0 deletions docs/source/_json/folder.resp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Content-Type: application/json
"exclude_from_nav": false,
"expires": null,
"id": "folder",
"is_folderish": true,
"items": [
{
"@id": "http://localhost:55001/plone/folder/doc1",
Expand Down
1 change: 1 addition & 0 deletions docs/source/_json/image.resp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Content-Type: application/json
"size": 1185,
"width": 215
},
"is_folderish": false,
"language": "",
"layout": "image_view",
"modified": "2016-01-21T06:24:11+00:00",
Expand Down
1 change: 1 addition & 0 deletions docs/source/_json/link.resp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Content-Type: application/json
"exclude_from_nav": false,
"expires": null,
"id": "link",
"is_folderish": false,
"language": "",
"layout": "link_redirect_view",
"modified": "2016-01-21T04:24:11+00:00",
Expand Down
1 change: 1 addition & 0 deletions docs/source/_json/newsitem.resp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Content-Type: application/json
"width": 215
},
"image_caption": "This is an image caption.",
"is_folderish": false,
"language": "",
"layout": "newsitem_view",
"modified": "2016-01-21T02:24:11+00:00",
Expand Down
3 changes: 3 additions & 0 deletions src/plone/restapi/serializer/dxcontent.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def __call__(self, version=None):
'UID': obj.UID(),
'version': version,
'layout': self.context.getLayout(),
'is_folderish': False
}

# Insert expandable elements
Expand Down Expand Up @@ -121,6 +122,8 @@ def __call__(self, version=None):
version=version
)

folder_metadata.update({'is_folderish': True})

query = self._build_query()

catalog = getToolByName(self.context, 'portal_catalog')
Expand Down
13 changes: 13 additions & 0 deletions src/plone/restapi/tests/test_dxcontent_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,16 @@ def test_serializer_includes_expansion(self):
obj = self.serialize()
self.assertIn('foo', obj['@components'])
self.assertEqual('collapsed', obj['@components']['foo'])

def test_get_is_folderish(self):
obj = self.serialize()
self.assertIn('is_folderish', obj)
self.assertEquals(False, obj['is_folderish'])

def test_get_is_folderish_in_folder(self):
self.portal.invokeFactory('Folder', id=u'folder')
serializer = getMultiAdapter((self.portal.folder, self.request),
ISerializeToJson)
obj = serializer()
self.assertIn('is_folderish', obj)
self.assertEquals(True, obj['is_folderish'])
2 changes: 1 addition & 1 deletion versions.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ requests = 2.18.4

# Misc
plone.testing = 4.3.0
pytz = 2017.2
pytz = 2017.3
zope.interface = 4.0.5

0 comments on commit 914367a

Please sign in to comment.