Skip to content

Commit

Permalink
Merge pull request #581 from mdhaman/SD-5506
Browse files Browse the repository at this point in the history
fix(content_filters):Fixing the query for genre in content filters.
  • Loading branch information
petrjasek committed Sep 19, 2016
2 parents 3563edb + 9b2a716 commit f918f3b
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 f918f3b

Please sign in to comment.