diff --git a/news/106.feature b/news/106.feature new file mode 100644 index 0000000..6362e80 --- /dev/null +++ b/news/106.feature @@ -0,0 +1 @@ +include vocabulary term token in termlist used to configure the querystring search [jackahl] (#106) diff --git a/plone/app/querystring/registryreader.py b/plone/app/querystring/registryreader.py index fa5a783..49c93b4 100644 --- a/plone/app/querystring/registryreader.py +++ b/plone/app/querystring/registryreader.py @@ -93,13 +93,13 @@ def getVocabularyValues(self, values): title = translate(item.title, context=self.request) else: title = item.title - translated.append((title, item.value)) + translated.append((title, item.value, item.token)) translated = sorted( translated, key=lambda x: normalizeString(safe_unicode(x[0])) ) - for (title, value) in translated: - field['values'][value] = {'title': title} + for (title, value, token) in translated: + field['values'][value] = {'title': title, 'token': token} return values diff --git a/plone/app/querystring/tests/testRegistryReader.py b/plone/app/querystring/tests/testRegistryReader.py index 4f8ea15..d041da5 100644 --- a/plone/app/querystring/tests/testRegistryReader.py +++ b/plone/app/querystring/tests/testRegistryReader.py @@ -77,7 +77,7 @@ def test_get_vocabularies(self): result = reader.getVocabularyValues(result) vocabulary_result = result.get( 'plone.app.querystring.field.reviewState.values') - self.assertEqual(vocabulary_result, {'foo': {'title': u'bar'}}) + self.assertEqual(vocabulary_result, {'foo': {'title': u'bar', 'token': 'foo'}}) def test_map_operations_clean(self): """tests if mapOperations is getting all operators correctly"""