Skip to content

Commit

Permalink
Avoid obsolete type casting
Browse files Browse the repository at this point in the history
  • Loading branch information
andbag committed Jun 4, 2019
1 parent 2815927 commit 2a45691
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/Products/PluginIndexes/KeywordIndex/KeywordIndex.py
Expand Up @@ -156,23 +156,22 @@ def _getSpecialValueFor(datum):
except KeyError:
pass

keywords = OOSet()
# normalize datum
if isinstance(newKeywords, basestring):
newKeywords = (newKeywords,)
keywords.insert(newKeywords)
else:
try:
# unique
newKeywords = set(newKeywords)
keywords.update(newKeywords)
except TypeError:
# Not a sequence
newKeywords = (newKeywords,)
else:
newKeywords = tuple(newKeywords)
keywords.insert(newKeywords)

try:
return _getSpecialValueFor(newKeywords)
return _getSpecialValueFor(tuple(keywords))
except KeyError:
return newKeywords
return keywords

def index_objectKeywords(self, documentId, keywords):
""" carefully index the object with integer id 'documentId'"""
Expand Down

0 comments on commit 2a45691

Please sign in to comment.