Skip to content

Commit

Permalink
[#445] Refactor a loop in multilingual plugin
Browse files Browse the repository at this point in the history
This just makes a small loop in ckanext/multilingual clearer, the logic
should be the same.
  • Loading branch information
Sean Hammond committed Feb 25, 2013
1 parent 5fe6873 commit 1e8a1a2
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions ckanext/multilingual/plugin.py
Expand Up @@ -124,14 +124,11 @@ def before_index(self, search_data):
for key, value in search_data.iteritems():
if key in KEYS_TO_IGNORE or key.startswith('title'):
continue
if isinstance(value, list):
for item in value:
if isinstance(item, basestring):
all_terms.append(item)
elif not isinstance(value, basestring):
continue
else:
all_terms.append(value)
if not isinstance(value, list):
value = [value]
for item in value:
if isinstance(item, basestring):
all_terms.append(item)

field_translations = action_get.term_translation_show(
{'model': ckan.model},
Expand Down

0 comments on commit 1e8a1a2

Please sign in to comment.