Commit 4e6267c6 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Arnaud Fontaine

py2/py3: maketrans() is different.

parent 269722e7
......@@ -26,9 +26,13 @@
##############################################################################
import string, re
import six
redundant_chars='"\'.:;,-+<>()*~' # chars we need to strip from a word before we see if it matches, and from the searchwords to eliminate boolean mode chars
tr=string.maketrans(redundant_chars,' '*len(redundant_chars))
if six.PY2:
tr=string.maketrans(redundant_chars,' '*len(redundant_chars))
else:
tr = str.maketrans('', '', redundant_chars)
class Done(Exception):
pass
......
......@@ -103,8 +103,12 @@ class CachedConvertableMixin:
http://pypi.python.org/pypi/uuid/ to generate
a uuid stored as private property.
"""
if six.PY2:
format_cache_id = str(makeSortedTuple(kw)).\
translate(string.maketrans('', ''), '[]()<>\'", ')
else:
format_cache_id = str(makeSortedTuple(kw)).\
translate(str.maketrans('', '', '[]()<>\'", '))
return '%s:%s:%s' % (aq_base(self).getUid(), self.getRevision(),
format_cache_id)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment