adjust to new Localizer

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33058 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6abb625b
...@@ -131,14 +131,19 @@ try: ...@@ -131,14 +131,19 @@ try:
# Workaround Localizer >= 1.2 patch that doesn't work with # Workaround Localizer >= 1.2 patch that doesn't work with
# ZopeTestCase REQUESTs (it's the same as iHotFix # ZopeTestCase REQUESTs (it's the same as iHotFix
from Products.Localizer import patches from Products.Localizer import patches
from types import UnicodeType # revert monkey patches from Localizer
# revert monkey patchs from Localizer
patches.get_request = get_request patches.get_request = get_request
except ImportError:
pass
try:
from Products.Localizer import patches
# originalStringIO has been removed from recent Localizer versions
from Products.Localizer.patches import originalStringIO
class UnicodeSafeStringIO(patches.originalStringIO): class UnicodeSafeStringIO(patches.originalStringIO):
"""StringIO like class which never fails with unicode.""" """StringIO like class which never fails with unicode."""
def write(self, s): def write(self, s):
if isinstance(s, UnicodeType): if isinstance(s, unicode):
s = s.encode('utf8', 'repr') s = s.encode('utf8', 'repr')
patches.originalStringIO.write(self, s) patches.originalStringIO.write(self, s)
# Localizer will patch PageTemplate StringIO with # Localizer will patch PageTemplate StringIO with
......
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