From 45a44d08ebb92c869880e2ec7277fe085ab0cb3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 28 Sep 2017 17:51:25 +0200 Subject: [PATCH] Don't manually construct JSON as strings, just use dicts. The modernity! --- pillar/web/nodes/custom/posts.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pillar/web/nodes/custom/posts.py b/pillar/web/nodes/custom/posts.py index ba50e778..f6084326 100644 --- a/pillar/web/nodes/custom/posts.py +++ b/pillar/web/nodes/custom/posts.py @@ -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)