Skip to content

Commit

Permalink
Update plone/app/vocabularies/terms.py
Browse files Browse the repository at this point in the history
Co-authored-by: Jens W. Klein <jk@kleinundpartner.at>
  • Loading branch information
flipmcf and jensens authored Nov 4, 2020
1 parent 923f0cc commit a1fec9a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions plone/app/vocabularies/terms.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ def safe_simpleterm_from_value(value):
- token need cleaned up: Vocabulary term tokens *must* be 7 bit values
- anything for display has to be cleaned up, titles *must* be unicode
"""
return SimpleTerm(value,
b2a_base64(safe_encode(value), newline=False),
safe_unicode(value)
)
if isinstance(value, six.text_type):
try:
token = value.decode('ascii')
except UnicodeDecodeError:
token = b2a_base64(safe_encode(value)).strip()
else:
token = b2a_base64(safe_encode(value)).strip()
return SimpleTerm(value, token, safe_unicode(value))


def safe_simplevocabulary_from_values(values, query=None):
Expand Down

0 comments on commit a1fec9a

Please sign in to comment.