Commit 4a7790cd authored by Jérome Perrin's avatar Jérome Perrin Committed by Cédric Le Ninivin

TemplateTool: use json to encode repository business template uid

parent 903f067d
...@@ -54,13 +54,13 @@ import re ...@@ -54,13 +54,13 @@ import re
from xml.dom.minidom import parse from xml.dom.minidom import parse
from xml.parsers.expat import ExpatError from xml.parsers.expat import ExpatError
import struct import struct
import cPickle
from base64 import b64encode, b64decode from base64 import b64encode, b64decode
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
from zLOG import LOG, INFO, WARNING from zLOG import LOG, INFO, WARNING
from base64 import decodestring from base64 import decodestring
import subprocess import subprocess
import time import time
import json
WIN = os.name == 'nt' WIN = os.name == 'nt'
...@@ -703,7 +703,8 @@ class TemplateTool (BaseTool): ...@@ -703,7 +703,8 @@ class TemplateTool (BaseTool):
Decode the uid of a business template from a repository. Decode the uid of a business template from a repository.
Return a repository and an id. Return a repository and an id.
""" """
return cPickle.loads(b64decode(uid)) repository, id = json.loads(b64decode(uid))
return repository.encode('utf-8'), id.encode('utf-8')
security.declarePublic( 'encodeRepositoryBusinessTemplateUid' ) security.declarePublic( 'encodeRepositoryBusinessTemplateUid' )
def encodeRepositoryBusinessTemplateUid(self, repository, id): def encodeRepositoryBusinessTemplateUid(self, repository, id):
...@@ -711,7 +712,7 @@ class TemplateTool (BaseTool): ...@@ -711,7 +712,7 @@ class TemplateTool (BaseTool):
encode the repository and the id of a business template. encode the repository and the id of a business template.
Return an uid. Return an uid.
""" """
return b64encode(cPickle.dumps((repository, id))) return b64encode(json.dumps((repository, id)))
security.declarePublic('compareVersionStrings') security.declarePublic('compareVersionStrings')
def compareVersionStrings(self, version, comparing_string): def compareVersionStrings(self, version, comparing_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