Commit 6684d553 authored by Kevin Deldycke's avatar Kevin Deldycke

Support python 2.4 and python 2.3


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6089 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 092a1ccd
...@@ -32,14 +32,25 @@ from Products.PythonScripts.Utility import allow_class ...@@ -32,14 +32,25 @@ from Products.PythonScripts.Utility import allow_class
from Products.PageTemplates.GlobalTranslationService import getGlobalTranslationService from Products.PageTemplates.GlobalTranslationService import getGlobalTranslationService
from Globals import get_request from Globals import get_request
from cPickle import dumps, loads from cPickle import dumps, loads
from base64 import b64encode, b64decode
try: try:
from string import Template from string import Template
except ImportError: except ImportError:
from Products.ERP5Type.patches.string import Template from Products.ERP5Type.patches.string import Template
# API of base64 has changed between python v2.3 and v2.4
import base64
try:
# python v2.4 API
b64encode = base64.b64encode
b64decode = base64.b64decode
except AttributeError:
# python v2.3 API
b64encode = base64.encodestring
b64decode = base64.decodestring
class Message(Persistent): class Message(Persistent):
""" """
This class encapsulates message, mapping and domain for a given message This class encapsulates message, mapping and domain for a given message
...@@ -59,7 +70,7 @@ class Message(Persistent): ...@@ -59,7 +70,7 @@ class Message(Persistent):
Return a pickle version of the object Return a pickle version of the object
""" """
return b64encode(dumps(self, 2)) return b64encode(dumps(self, 2))
security.declarePublic('load') security.declarePublic('load')
def load(self, string): def load(self, string):
""" """
......
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