Skip to content

Commit

Permalink
[#2439] Sanitise method parameters.
Browse files Browse the repository at this point in the history
And comment reason for making the list copy.

Response to feedback from code-review.
  • Loading branch information
Ian Murray committed Jun 29, 2012
1 parent 85310d4 commit 54e8722
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ckan/lib/search/query.py
Expand Up @@ -150,7 +150,10 @@ def run(self, query=None, terms=[], fields={}, facet_by=[], options=None, **kwar

class TagSearchQuery(SearchQuery):
"""Search for tags."""
def run(self, query=[], fields={}, options=None, **kwargs):
def run(self, query=None, fields=None, options=None, **kwargs):
query = [] if query is None else query
fields = {} if fields is None else fields

if options is None:
options = QueryOptions(**kwargs)
else:
Expand All @@ -159,7 +162,7 @@ def run(self, query=[], fields={}, options=None, **kwargs):
if isinstance(query, basestring):
query = [query]

query = query[:]
query = query[:] # don't alter caller's query list.
for field, value in fields.items():
if field in ('tag', 'tags'):
query.append(value)
Expand Down

0 comments on commit 54e8722

Please sign in to comment.