Fix compatibility between python2 and 3

This commit is contained in:
Jean-Marc Martins
2013-09-19 14:40:03 +02:00
parent 6c40f5e24a
commit a631c8c761
5 changed files with 18 additions and 11 deletions

View File

@ -103,7 +103,8 @@ class Item(object):
self.text = self.text.replace(
"\nEND:", "\nX-RADICALE-NAME:%s\nEND:" % self._name)
else:
self._name = str(uuid4())
# workaround to get unicode on both python2 and 3
self._name = uuid4().hex.encode("ascii").decode("ascii")
self.text = self.text.replace(
"\nEND:", "\nX-RADICALE-NAME:%s\nEND:" % self._name)