Skip to content

Commit

Permalink
[SD-5506] Fixing the query for genre in content filters.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayur Dhamanwala authored and petrjasek committed Sep 19, 2016
1 parent 64123a9 commit bde416b
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license

import json
from superdesk.resource import Resource
from superdesk.services import BaseService
from superdesk.utils import ListCursor
Expand Down Expand Up @@ -94,8 +95,10 @@ def _get_field_values(self):
vocabularies_resource = get_resource_service('vocabularies')
values['anpa_category'] = vocabularies_resource.find_one(req=None, _id='categories')['items']
req = ParsedRequest()
req.where = {'$or': [{"schema_field": "genre"}, {"_id": "genre"}]}
values['genre'] = vocabularies_resource.find_one(req=req)['items']
req.where = json.dumps({'$or': [{"schema_field": "genre"}, {"_id": "genre"}]})
genre = vocabularies_resource.get(req=req, lookup=None)
if genre.count():
values['genre'] = genre[0]['items']
values['urgency'] = vocabularies_resource.find_one(req=None, _id='urgency')['items']
values['priority'] = vocabularies_resource.find_one(req=None, _id='priority')['items']
values['type'] = vocabularies_resource.find_one(req=None, _id='type')['items']
Expand Down

0 comments on commit bde416b

Please sign in to comment.