From 5fe687381cc5fcf9cc340e98b921d7af38215a35 Mon Sep 17 00:00:00 2001 From: Sean Hammond Date: Fri, 22 Feb 2013 18:00:54 +0100 Subject: [PATCH] [#445] Only lookup strings in term translation table This fixes the multilingual tests that are currently failing on master. It seems that when the multilingual extension was written, package dicts never contained ints as values. Now they do. But postgres cannot compare an int to a string so it crashes. This commit changes the multilingual plugin so that it only tries to lookup strings in the term translation table, other types are just skipped. Fixes #445. --- ckanext/multilingual/plugin.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ckanext/multilingual/plugin.py b/ckanext/multilingual/plugin.py index 0766b2e0d7f..a6d0b48a3a8 100644 --- a/ckanext/multilingual/plugin.py +++ b/ckanext/multilingual/plugin.py @@ -125,8 +125,10 @@ def before_index(self, search_data): if key in KEYS_TO_IGNORE or key.startswith('title'): continue if isinstance(value, list): - all_terms.extend(value) - elif value in (None, True, False): + for item in value: + if isinstance(item, basestring): + all_terms.append(item) + elif not isinstance(value, basestring): continue else: all_terms.append(value)