Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
142
Merge Requests
142
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
c8c22b2e
Commit
c8c22b2e
authored
Apr 28, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TemplateTool: use json to encode repository business template uid
parent
49af5d62
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
product/ERP5/Tool/TemplateTool.py
product/ERP5/Tool/TemplateTool.py
+6
-5
No files found.
product/ERP5/Tool/TemplateTool.py
View file @
c8c22b2e
...
...
@@ -64,7 +64,6 @@ import re
from
xml.dom.minidom
import
parse
from
xml.parsers.expat
import
ExpatError
import
struct
from
six.moves
import
cPickle
as
pickle
from
base64
import
b64encode
,
b64decode
from
Products.ERP5Type.Message
import
translateString
from
zLOG
import
LOG
,
INFO
,
WARNING
...
...
@@ -72,6 +71,7 @@ from base64 import decodestring
import
subprocess
import
time
from
Products.ERP5Type.Utils
import
bytes2str
import
json
WIN
=
os
.
name
==
'nt'
...
...
@@ -534,12 +534,12 @@ class TemplateTool (BaseTool):
if REQUEST is None:
REQUEST = getattr(self, '
REQUEST
', None)
if len(repository_list) == 0 and REQUEST:
ret_url = self.absolute_url()
REQUEST.RESPONSE.redirect("%s?portal_status_message=%s"
% (ret_url, '
No
repository
was
defined
'))
for repository in repository_list:
repository = repository.rstrip('
\
n
')
repository = repository.rstrip('
\
r')
...
...
@@ -720,7 +720,8 @@ class TemplateTool (BaseTool):
Decode the uid of a business template from a repository.
Return a repository and an id.
"""
return pickle.loads(b64decode(uid))
repository, id = json.loads(b64decode(uid))
return repository.encode('
utf
-
8
'), id.encode('
utf
-
8
')
security.declarePublic( '
encodeRepositoryBusinessTemplateUid
' )
def encodeRepositoryBusinessTemplateUid(self, repository, id):
...
...
@@ -728,7 +729,7 @@ class TemplateTool (BaseTool):
encode the repository and the id of a business template.
Return an uid.
"""
return b64encode(
pickle
.dumps((repository, id)))
return b64encode(
json
.dumps((repository, id)))
security.declarePublic('
compareVersionStrings
')
def compareVersionStrings(self, version, comparing_string):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment