Commit 41d63298 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Backward compatibility for base64


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4848 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 36fa2aba
...@@ -49,7 +49,10 @@ import re ...@@ -49,7 +49,10 @@ import re
from xml.dom.minidom import parse from xml.dom.minidom import parse
import struct import struct
import cPickle import cPickle
import base64 try:
from base64 import b64encode, b64decode
except ImportError:
from base64 import encodestring as b64encode, decodestring as b64decode
class LocalConfiguration(Implicit): class LocalConfiguration(Implicit):
""" """
...@@ -510,7 +513,7 @@ class TemplateTool (BaseTool): ...@@ -510,7 +513,7 @@ class TemplateTool (BaseTool):
def decodeRepositoryBusinessTemplateUid(self, uid): def decodeRepositoryBusinessTemplateUid(self, uid):
"""Decode the uid of a business template in a repository. Return a repository and an id. """Decode the uid of a business template in a repository. Return a repository and an id.
""" """
return cPickle.loads(base64.b64decode(uid)) return cPickle.loads(b64decode(uid))
security.declareProtected( Permissions.AccessContentsInformation, 'getRepositoryBusinessTemplateList' ) security.declareProtected( Permissions.AccessContentsInformation, 'getRepositoryBusinessTemplateList' )
def getRepositoryBusinessTemplateList(self, update_only=0, **kw): def getRepositoryBusinessTemplateList(self, update_only=0, **kw):
...@@ -564,7 +567,7 @@ class TemplateTool (BaseTool): ...@@ -564,7 +567,7 @@ class TemplateTool (BaseTool):
elif result < 0: elif result < 0:
version_state = 'old' version_state = 'old'
version_state_title = version_state_title_dict[version_state] version_state_title = version_state_title_dict[version_state]
uid = base64.b64encode(cPickle.dumps((repository, id))) uid = b64encode(cPickle.dumps((repository, id)))
obj = newTempBusinessTemplate(self, 'temp_' + uid, obj = newTempBusinessTemplate(self, 'temp_' + uid,
version_state = version_state, version_state = version_state,
version_state_title = version_state_title, version_state_title = version_state_title,
......
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