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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
126ae257
Commit
126ae257
authored
Sep 23, 2022
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! py2/py3: dict_key does not have sort().
parent
c98ecf4a
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
44 additions
and
59 deletions
+44
-59
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+26
-30
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_callDialogMethod.py
...plateItem/portal_skins/erp5_core/Base_callDialogMethod.py
+3
-3
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_getDiffObjectList.py
...tal_skins/erp5_core/BusinessTemplate_getDiffObjectList.py
+2
-6
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_getModifiedObject.py
...tal_skins/erp5_core/BusinessTemplate_getModifiedObject.py
+3
-5
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ListBox_initializeFastInput.py
...tem/portal_skins/erp5_core/ListBox_initializeFastInput.py
+1
-1
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_getModifiedObjectList.py
...tal_skins/erp5_core/TemplateTool_getModifiedObjectList.py
+2
-2
product/ERP5Type/XMLExportImport/__init__.py
product/ERP5Type/XMLExportImport/__init__.py
+5
-7
product/Localizer/MessageCatalog.py
product/Localizer/MessageCatalog.py
+1
-3
product/MailTemplates/BaseMailTemplate.py
product/MailTemplates/BaseMailTemplate.py
+1
-2
No files found.
product/ERP5/Document/BusinessTemplate.py
View file @
126ae257
This diff is collapsed.
Click to expand it.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_callDialogMethod.py
View file @
126ae257
...
...
@@ -2,6 +2,7 @@
Generic method called when submitting a form in dialog mode.
Responsible for validating form data and redirecting to the form action.
"""
import
six
# XXX We should not use meta_type properly,
# XXX We need to discuss this problem.(yusei)
...
...
@@ -131,9 +132,8 @@ if len(listbox_id_list):
for
listbox_id
in
listbox_id_list
:
listbox_line_list
=
[]
listbox
=
kw
[
listbox_id
]
listbox_keys
=
listbox
.
keys
()
for
key
in
sorted
(
listbox_keys
):
listbox_line
=
listbox
[
key
]
for
key
,
value
in
sorted
(
six
.
iteritems
(
listbox
)):
listbox_line
=
value
listbox_line
[
'listbox_key'
]
=
key
listbox_line_list
.
append
(
listbox_line
)
listbox_line_list
=
tuple
(
listbox_line_list
)
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_getDiffObjectList.py
View file @
126ae257
...
...
@@ -35,16 +35,12 @@ if p.portal_templates.compareVersions(bt1.getVersion(), bt2.getVersion()) < 0:
else
:
modified_object_list
=
getModifiedObjectList
(
bt1
,
bt2
)
keys
=
modified_object_list
.
keys
()
i
=
0
object_list
=
[]
for
object_id
in
sorted
(
keys
):
object_state
,
object_class
=
modified_object_list
[
object_id
]
for
i
,
(
object_id
,
value
)
in
enumerate
(
sorted
(
six
.
iteritems
(
modified_object_list
))
):
object_state
,
object_class
=
value
line
=
newTempBase
(
context
,
'tmp_install_%s'
%
(
str
(
i
)))
line
.
edit
(
object_id
=
object_id
,
object_state
=
object_state
,
object_class
=
object_class
,
bt1
=
bt1
.
getId
(),
bt2
=
bt2
.
getId
())
line
.
setUid
(
'new_%s'
%
object_id
)
object_list
.
append
(
line
)
i
+=
1
return
object_list
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_getModifiedObject.py
View file @
126ae257
from
Products.ERP5Type.Document
import
newTempBase
from
Products.ERP5Type.Cache
import
CachingMethod
from
Products.ERP5Type.Utils
import
ensure_list
import
six
Base_translateString
=
context
.
Base_translateString
def
getModifiedObjectList
(
context
):
...
...
@@ -21,7 +22,6 @@ getModifiedObjectList = CachingMethod(getModifiedObjectList,
cache_id_generator
=
cache_id_generator
)
modified_object_list
=
getModifiedObjectList
(
context
)
keys
=
ensure_list
(
modified_object_list
.
keys
())
no_backup_list
=
[
'Action'
,
'SiteProperty'
,
'Module'
,
'Document'
,
'PropertySheet'
,
'Extension'
,
'Test'
,
'Product'
,
'Role'
,
...
...
@@ -40,10 +40,9 @@ backup_title = Base_translateString('Backup And Upgrade')
remove_title
=
Base_translateString
(
'Remove'
)
save_and_remove_title
=
Base_translateString
(
'Backup And Remove'
)
i
=
0
object_list
=
[]
for
object_id
in
sorted
(
keys
):
object_state
,
object_class
=
modified_object_list
[
object_id
]
for
i
,
(
object_id
,
value
)
in
enumerate
(
sorted
(
six
.
iteritems
(
modified_object_list
))
):
object_state
,
object_class
=
value
line
=
newTempBase
(
context
,
'tmp_install_%s'
%
(
str
(
i
)))
if
object_state
==
'New'
:
choice_item_list
=
[[
install_title
,
'install'
]]
...
...
@@ -66,7 +65,6 @@ for object_id in sorted(keys):
choice_item_list
=
choice_item_list
)
line
.
setUid
(
'new_%s'
%
str
(
object_id
))
object_list
.
append
(
line
)
i
+=
1
object_list
.
sort
(
key
=
lambda
x
:(
x
.
object_class
,
x
.
object_state
))
return
object_list
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ListBox_initializeFastInput.py
View file @
126ae257
...
...
@@ -19,7 +19,7 @@ if hasattr(request, listbox_id):
# initialize the listbox
listbox
=
request
[
listbox_id
]
keys_list
=
sorted
(
listbox
.
keys
()
,
key
=
int
)
keys_list
=
sorted
(
listbox
,
key
=
int
)
if
keys_list
!=
[]:
first_empty_line_id
=
int
(
keys_list
[
-
1
])
+
1
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_getModifiedObjectList.py
View file @
126ae257
import
six
REQUEST
=
container
.
REQUEST
Base_translateString
=
context
.
Base_translateString
...
...
@@ -45,8 +46,7 @@ save_and_remove_title = Base_translateString('Backup And Remove')
for
bt
in
bt_id_list
:
bt_title
,
modified_object_list
=
bt_object_dict
[
bt
]
keys
=
modified_object_list
.
keys
()
for
i
,
object_id
in
enumerate
(
sorted
(
keys
)):
for
i
,
(
object_id
,
value
)
in
enumerate
(
sorted
(
six
.
iteritems
(
modified_object_list
))):
object_state
,
object_class
=
modified_object_list
[
object_id
]
object_id
=
bt
+
'|'
+
object_id
line
=
newTempBase
(
context
,
'tmp_install_%s'
%
i
)
...
...
product/ERP5Type/XMLExportImport/__init__.py
View file @
126ae257
...
...
@@ -143,26 +143,24 @@ def Base_asXML(object, root=None):
# We have to describe the workflow history
if
getattr
(
self
,
'workflow_history'
,
None
)
is
not
None
:
workflow_list
=
self
.
workflow_history
workflow_list_keys
=
workflow_list
.
keys
()
for
workflow_id
in
sorted
(
workflow_list_keys
):
# Make sure it is sorted
for
workflow_action
in
workflow_
list
[
workflow_id
]
:
for
workflow_id
,
workflow_action_list
in
sorted
(
six
.
iteritems
(
workflow_list
)
):
# Make sure it is sorted
for
workflow_action
in
workflow_
action_list
:
workflow_node
=
SubElement
(
object
,
'workflow_action'
,
attrib
=
dict
(
workflow_id
=
workflow_id
))
workflow_variable_list
=
workflow_action
.
keys
()
for
workflow_variable
in
sorted
(
workflow_variable_list
):
for
workflow_variable
,
variable_node_text
in
sorted
(
six
.
iteritems
(
workflow_action
)
):
variable_type
=
"string"
# Somewhat bad, should find a better way
if
workflow_variable
.
find
(
'time'
)
>=
0
:
variable_type
=
"date"
if
workflow_variable
.
find
(
'language_revs'
)
>=
0
:
# XXX specific to cps
variable_type
=
"dict"
if
workflow_action
[
workflow_variable
]
is
None
:
if
variable_node_text
is
None
:
variable_type
=
'None'
variable_node
=
SubElement
(
workflow_node
,
workflow_variable
,
attrib
=
dict
(
type
=
variable_type
))
if
variable_type
!=
'None'
:
variable_node_text
=
str
(
workflow_action
[
workflow_variable
])
variable_node
.
text
=
six
.
text_type
(
variable_node_text
,
'utf-8'
)
variable_node
.
text
=
six
.
text_type
(
str
(
variable_node_text
),
'utf-8'
)
if
workflow_variable
==
'time'
:
time
=
variable_node
.
text
...
...
product/Localizer/MessageCatalog.py
View file @
126ae257
...
...
@@ -644,10 +644,8 @@ class MessageCatalog(LanguageManager, ObjectManager, SimpleItem):
return
x
# Generate sorted msgids to simplify diffs
dkeys
=
d
.
keys
()
for
k
in
sorted
(
dkeys
):
for
k
,
v
in
sorted
(
six
.
iteritems
(
d
)):
r
.
append
(
'msgid "%s"'
%
backslashescape
(
k
))
v
=
d
[
k
]
r
.
append
(
'msgstr "%s"'
%
backslashescape
(
v
))
r
.
append
(
''
)
...
...
product/MailTemplates/BaseMailTemplate.py
View file @
126ae257
...
...
@@ -118,8 +118,7 @@ class BaseMailTemplate:
# we want to have it stored in ERP5, for mail threading
headers
[
'Message-ID'
]
=
make_msgid
()
# turn headers into an ordered list for predictable header order
keys
=
headers
.
keys
()
return
msg
,
values
,[(
key
,
headers
[
key
])
for
key
in
sorted
(
keys
)]
return
msg
,
values
,
[(
key
,
value
)
for
key
,
value
in
sorted
(
six
.
iteritems
(
headers
))]
security
.
declarePrivate
(
'_send'
)
def
_send
(
self
,
mfrom
,
mto
,
msg
):
...
...
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