Don't manually construct JSON as strings, just use dicts. The modernity!

This commit is contained in:
Sybren A. Stüvel 2017-09-28 17:51:25 +02:00
parent ddc52b969e
commit 45a44d08eb

View File

@ -40,10 +40,10 @@ def posts_view(project_id=None, project_url=None, url=None):
'where': {'node_type': 'blog', 'project': project_id},
}, api=api)
status_query = "" if blog.has_method('PUT') else ', "properties.status": "published"'
status_query = {} if blog.has_method('PUT') else {'properties.status': 'published'}
posts = Node.all({
'where': '{"parent": "%s" %s}' % (blog._id, status_query),
'embedded': '{"user": 1}',
'where': {'parent': blog._id, **status_query},
'embedded': {'user': 1},
'sort': '-_created'
}, api=api)