Skip to content

Commit

Permalink
Do not hard-code @@JSON into @id property.
Browse files Browse the repository at this point in the history
  • Loading branch information
tisto committed Apr 20, 2015
1 parent 66e8541 commit da4a54e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions docs/source/_json/collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
"limit": "1000",
"member": [
{
"@id": "http://localhost:55001/plone/front-page/@@json",
"@id": "http://localhost:55001/plone/front-page",
"description": "Congratulations! You have successfully installed Plone.",
"title": "Welcome to Plone"
},
{
"@id": "http://localhost:55001/plone/doc1/@@json",
"@id": "http://localhost:55001/plone/doc1",
"description": "",
"title": "Document 1"
},
{
"@id": "http://localhost:55001/plone/doc2/@@json",
"@id": "http://localhost:55001/plone/doc2",
"description": "",
"title": "Document 2"
}
Expand Down
2 changes: 1 addition & 1 deletion src/plone/restapi/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def SerializeToJson(context):
portal = getSite()
result['member'] = [
{
'@id': '{0}/{1}/@@json'.format(
'@id': '{0}/{1}'.format(
portal.absolute_url(),
'/'.join(member.getPhysicalPath())
),
Expand Down
5 changes: 3 additions & 2 deletions src/plone/restapi/tests/test_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ def test_serialize_to_json_collection(self):
)
self.portal.doc1.reindexObject()
self.portal.doc2.reindexObject()

self.assertEqual(
u'Collection',
json.loads(ISerializeToJson(self.portal.collection1)).get('@type')
Expand All @@ -192,12 +193,12 @@ def test_serialize_to_json_collection(self):
self.assertEqual(
[
{
u'@id': self.portal.doc1.absolute_url() + '/@@json',
u'@id': self.portal.doc1.absolute_url(),
u'description': u'',
u'title': u'Document 1'
},
{
u'@id': self.portal.doc2.absolute_url() + '/@@json',
u'@id': self.portal.doc2.absolute_url(),
u'description': u'',
u'title': u'Document 2'
}
Expand Down

0 comments on commit da4a54e

Please sign in to comment.