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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
erp5
Commits
c9bf1d3d
Commit
c9bf1d3d
authored
Oct 08, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into zope4py2
parents
2042bdf4
de8ed690
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
62 additions
and
263 deletions
+62
-263
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py
...eItem/portal_components/test.erp5.testBusinessTemplate.py
+12
-2
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_forge/BusinessTemplate_createSkinFolder.py
...tal_skins/erp5_forge/BusinessTemplate_createSkinFolder.py
+4
-2
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/BusinessTemplate_createReport.py
...ortal_skins/erp5_toolbox/BusinessTemplate_createReport.py
+4
-2
bt5/erp5_forge/TestTemplateItem/portal_components/test.erp5.testERP5Toolbox.py
...mplateItem/portal_components/test.erp5.testERP5Toolbox.py
+6
-5
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+33
-178
product/ERP5Type/ZopePatch.py
product/ERP5Type/ZopePatch.py
+0
-1
product/ERP5Type/patches/make_hidden_input.py
product/ERP5Type/patches/make_hidden_input.py
+0
-53
product/ERP5Type/tests/ERP5TypeTestCase.py
product/ERP5Type/tests/ERP5TypeTestCase.py
+3
-20
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py
View file @
c9bf1d3d
...
...
@@ -3295,6 +3295,16 @@ class TestBusinessTemplate(BusinessTemplateMixin):
"""Tests the Title of the Template Tool."""
self
.
assertEqual
(
'Business Templates'
,
self
.
getTemplateTool
().
Title
())
def
test_business_template_properties_sorted
(
self
):
bt
=
self
.
portal
.
portal_templates
.
newContent
(
portal_type
=
'Business Template'
)
bt
.
edit
(
template_path_list
=
[
'b'
,
'c'
,
'a'
])
self
.
assertEqual
(
bt
.
getTemplatePathList
(),
[
'a'
,
'b'
,
'c'
])
bt
.
edit
(
template_keep_workflow_path_list
=
[
'b'
,
'c'
,
'a'
])
self
.
assertEqual
(
bt
.
getTemplateKeepWorkflowPathList
(),
[
'a'
,
'b'
,
'c'
])
bt
.
edit
(
template_keep_last_workflow_history_only_path_list
=
[
'b'
,
'c'
,
'a'
])
self
.
assertEqual
(
bt
.
getTemplateKeepLastWorkflowHistoryOnlyPathList
(),
[
'a'
,
'b'
,
'c'
])
def
test_01_checkNewSite
(
self
):
"""Test Check New Site"""
sequence_list
=
SequenceList
()
...
...
@@ -6812,7 +6822,7 @@ class TestBusinessTemplate(BusinessTemplateMixin):
portal_type
=
'Business Template'
,
title
=
self
.
id
(),
template_path_list
=
(
'portal_categories/test_category/**'
'portal_categories/test_category/**'
,
),
template_base_category_list
=
[
'test_category'
],
)
...
...
@@ -6883,7 +6893,7 @@ class TestBusinessTemplate(BusinessTemplateMixin):
portal_type
=
'Business Template'
,
title
=
self
.
id
(),
template_path_list
=
(
'portal_categories/test_category/**'
'portal_categories/test_category/**'
,
),
template_base_category_list
=
[
'test_category'
],
)
...
...
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_forge/BusinessTemplate_createSkinFolder.py
View file @
c9bf1d3d
...
...
@@ -5,7 +5,8 @@ portal = context.getPortalObject()
if
skin_folder_name
not
in
portal
.
portal_skins
.
objectIds
():
portal
.
portal_skins
.
manage_addFolder
(
skin_folder_name
)
if
skin_folder_name
not
in
(
context
.
getTemplateSkinIdList
()
or
[]):
context
.
setTemplateSkinIdList
(
tuple
(
context
.
getTemplateSkinIdList
()
or
[])
+
(
skin_folder_name
,
))
context
.
setTemplateSkinIdList
(
sorted
(
tuple
(
context
.
getTemplateSkinIdList
()
or
[])
+
(
skin_folder_name
,
)))
skin_folder
=
portal
.
portal_skins
[
skin_folder_name
]
...
...
@@ -30,7 +31,8 @@ if skin_layer_list:
registered_skin
=
'%s | %s'
%
(
skin_folder_name
,
skin_name
)
registered_skin_selection_list
=
context
.
getTemplateRegisteredSkinSelectionList
()
or
[]
if
registered_skin
not
in
registered_skin_selection_list
:
context
.
setTemplateRegisteredSkinSelectionList
(
tuple
(
registered_skin_selection_list
)
+
(
registered_skin
,
))
context
.
setTemplateRegisteredSkinSelectionList
(
sorted
(
tuple
(
registered_skin_selection_list
)
+
(
registered_skin
,
)))
if
not
all_skin_layers_selected
:
marker
=
[]
...
...
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/BusinessTemplate_createReport.py
View file @
c9bf1d3d
...
...
@@ -99,9 +99,11 @@ type_information.addAction(
# Associate the dialog with type information in business template meta data
if
context
.
getPortalType
()
==
'Business Template'
and
\
context
.
getInstallationState
()
!=
'installed'
:
context
.
setTemplateActionPathList
(
context
.
getTemplateActionPathList
()
+
context
.
setTemplateActionPathList
(
sorted
(
tuple
(
context
.
getTemplateActionPathList
())
+
(
'%s | %s'
%
(
portal_type
,
action_id
),
'%s | %s'
%
(
portal_type
,
action_id
.
replace
(
'_report'
,
'_export'
))
,
))
'%s | %s'
%
(
portal_type
,
action_id
.
replace
(
'_report'
,
'_export'
))
)
))
# Create the report
skin_folder
.
manage_addProduct
[
'ERP5Form'
].
addERP5Report
(
report_form_name
,
report_name
)
...
...
bt5/erp5_forge/TestTemplateItem/portal_components/test.erp5.testERP5Toolbox.py
View file @
c9bf1d3d
...
...
@@ -76,9 +76,10 @@ class TestBusinessTemplateScripts(ERP5TypeTestCase):
# actions were added to business template
self
.
assertEqual
(
(
[
'Foo Module | dummy_export_export'
,
'Foo Module | dummy_report_report'
),
'Foo Module | dummy_report_report'
,
],
self
.
business_template
.
getTemplateActionPathList
(),
)
...
...
@@ -97,7 +98,7 @@ class TestBusinessTemplateScripts(ERP5TypeTestCase):
self
.
assertIn
(
'dummy_skin_folder'
,
self
.
portal
.
portal_skins
.
objectIds
())
# skin is added to business template
self
.
assertEqual
(
(
'dummy_skin_folder'
,
'existing'
)
,
[
'dummy_skin_folder'
,
'existing'
]
,
self
.
business_template
.
getTemplateSkinIdList
())
def
test_BusinessTemplate_createSkinFolder_priority
(
self
):
...
...
@@ -154,8 +155,8 @@ class TestBusinessTemplateScripts(ERP5TypeTestCase):
# skin is added to business template
self
.
assertEqual
(
(
[
'dummy_skin_folder | SelectedSkinSelection'
,
'dummy_skin_folder | View'
,
'existing | SelectedSkinSelection'
,
)
,
self
.
business_template
.
getTemplateRegisteredSkinSelectionList
())
]
,
self
.
business_template
.
getTemplateRegisteredSkinSelectionList
())
product/ERP5/Document/BusinessTemplate.py
View file @
c9bf1d3d
...
...
@@ -45,6 +45,7 @@ from Products.CMFCore.utils import getToolByName
from
Products.PythonScripts.PythonScript
import
PythonScript
from
Products.ZSQLMethods.SQL
import
SQL
from
Products.ERP5Type.Accessor.Constant
import
PropertyGetter
as
ConstantGetter
from
Products.ERP5Type.Accessor.TypeDefinition
import
asList
from
Products.ERP5Type.Cache
import
transactional_cached
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.UnrestrictedMethod
import
super_user
...
...
@@ -5578,185 +5579,39 @@ Business Template is a set of definitions, such as skins, portal types and categ
download
=
1
)
return
export_string
def
_getOrderedList
(
self
,
id
):
def
_edit
(
self
,
*
args
,
**
kw
):
"""Make sure UI stores list properties as sorted.
"""
We have to set this method because we want an
ordered list
"""
method_id
=
'_baseGet%sList'
%
convertToUpperCase
(
id
)
result
=
getattr
(
self
,
method_id
)(())
if
result
is
None
:
result
=
()
if
result
!=
():
result
=
list
(
result
)
result
.
sort
()
# XXX Why do we need to return a tuple ?
result
=
tuple
(
result
)
return
result
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTemplateCatalogMethodIdList'
)
def
getTemplateCatalogMethodIdList
(
self
):
"""
We have to set this method because we want an
ordered list
"""
return
self
.
_getOrderedList
(
'template_catalog_method_id'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTemplateBaseCategoryList'
)
def
getTemplateBaseCategoryList
(
self
):
"""
We have to set this method because we want an
ordered list
"""
return
self
.
_getOrderedList
(
'template_base_category'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTemplateWorkflowIdList'
)
def
getTemplateWorkflowIdList
(
self
):
"""
We have to set this method because we want an
ordered list
"""
return
self
.
_getOrderedList
(
'template_workflow_id'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTemplatePortalTypeIdList'
)
def
getTemplatePortalTypeIdList
(
self
):
"""
We have to set this method because we want an
ordered list
"""
return
self
.
_getOrderedList
(
'template_portal_type_id'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTemplatePortalTypeWorkflowChainList'
)
def
getTemplatePortalTypeWorkflowChainList
(
self
):
"""
We have to set this method because we want an
ordered list
"""
return
self
.
_getOrderedList
(
'template_portal_type_workflow_chain'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTemplatePathList'
)
def
getTemplatePathList
(
self
):
"""
We have to set this method because we want an
ordered list
"""
return
self
.
_getOrderedList
(
'template_path'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTemplatePreferenceList'
)
def
getTemplatePreferenceList
(
self
):
"""
We have to set this method because we want an
ordered list
"""
return
self
.
_getOrderedList
(
'template_preference'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTemplatePortalTypeAllowedContentTypeList'
)
def
getTemplatePortalTypeAllowedContentTypeList
(
self
):
"""
We have to set this method because we want an
ordered list
"""
return
self
.
_getOrderedList
(
'template_portal_type_allowed_content_type'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTemplatePortalTypeHiddenContentTypeList'
)
def
getTemplatePortalTypeHiddenContentTypeList
(
self
):
"""
We have to set this method because we want an
ordered list
"""
return
self
.
_getOrderedList
(
'template_portal_type_hidden_content_type'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTemplatePortalTypePropertySheetList'
)
def
getTemplatePortalTypePropertySheetList
(
self
):
"""
We have to set this method because we want an
ordered list
"""
return
self
.
_getOrderedList
(
'template_portal_type_property_sheet'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTemplatePortalTypeBaseCategoryList'
)
def
getTemplatePortalTypeBaseCategoryList
(
self
):
"""
We have to set this method because we want an
ordered list
"""
return
self
.
_getOrderedList
(
'template_portal_type_base_category'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTemplateActionPathList'
)
def
getTemplateActionPathList
(
self
):
"""
We have to set this method because we want an
ordered list
"""
return
self
.
_getOrderedList
(
'template_action_path'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTemplatePortalTypeRoleList'
)
def
getTemplatePortalTypeRoleList
(
self
):
"""
We have to set this method because we want an
ordered list
"""
return
self
.
_getOrderedList
(
'template_portal_type_role'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTemplateLocalRoleList'
)
def
getTemplateLocalRoleList
(
self
):
"""
We have to set this method because we want an
ordered list
"""
return
self
.
_getOrderedList
(
'template_local_role'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTemplateSkinIdList'
)
def
getTemplateSkinIdList
(
self
):
"""
We have to set this method because we want an
ordered list
"""
return
self
.
_getOrderedList
(
'template_skin_id'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTemplateRegisteredSkinSelectionList'
)
def
getTemplateRegisteredSkinSelectionList
(
self
):
"""
We have to set this method because we want an
ordered list
"""
return
self
.
_getOrderedList
(
'template_registered_skin_selection'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTemplateRegisteredVersionPrioritySelectionList'
)
def
getTemplateRegisteredVersionPrioritySelectionList
(
self
):
"""
We have to set this method because we want an
ordered list
"""
try
:
return
self
.
_getOrderedList
(
'template_registered_version_priority_selection'
)
# This property may not be defined if erp5_property_sheets has not been
# upgraded yet
except
AttributeError
:
return
()
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTemplateModuleIdList'
)
def
getTemplateModuleIdList
(
self
):
"""
We have to set this method because we want an
ordered list
"""
return
self
.
_getOrderedList
(
'template_module_id'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTemplateMessageTranslationList'
)
def
getTemplateMessageTranslationList
(
self
):
"""
We have to set this method because we want an
ordered list
"""
return
self
.
_getOrderedList
(
'template_message_translation'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTemplateToolIdList'
)
def
getTemplateToolIdList
(
self
):
"""
We have to set this method because we want an
ordered list
"""
return
self
.
_getOrderedList
(
'template_tool_id'
)
edit_kw
=
{}
for
k
,
v
in
six
.
iteritems
(
kw
):
if
v
and
k
in
(
'template_action_path_list'
,
'template_base_category_list'
,
'template_catalog_method_id_list'
,
'template_local_role_list'
,
'template_message_translation_list'
,
'template_module_id_list'
,
'template_path_list'
,
'template_keep_path_list'
,
'template_keep_workflow_path_list'
,
'template_keep_last_workflow_history_only_path_list'
,
'template_portal_type_allowed_content_type_list'
,
'template_portal_type_base_category_list'
,
'template_portal_type_hidden_content_type_list'
,
'template_portal_type_id_list'
,
'template_portal_type_property_sheet_list'
,
'template_portal_type_role_list'
,
'template_portal_type_workflow_chain_list'
,
'template_preference_list'
,
'template_registered_skin_selection_list'
,
'template_registered_version_priority_selection_list'
,
'template_skin_id_list'
,
'template_tool_id_list'
,
'template_workflow_id_list'
,
):
v
=
sorted
(
asList
(
v
))
edit_kw
[
k
]
=
v
return
super
(
BusinessTemplate
,
self
).
_edit
(
*
args
,
**
edit_kw
)
def
_isInKeepList
(
self
,
keep_list
,
path
):
for
keep_path
in
keep_list
:
...
...
product/ERP5Type/ZopePatch.py
View file @
c9bf1d3d
...
...
@@ -70,7 +70,6 @@ if WITH_LEGACY_WORKFLOW:
from
Products.ERP5Type.patches
import
StateChangeInfoPatch
from
Products.ERP5Type.patches
import
transforms
from
Products.ERP5Type.patches
import
OFSPdata
from
Products.ERP5Type.patches
import
make_hidden_input
from
Products.ERP5Type.patches
import
DemoStorage
from
Products.ERP5Type.patches
import
unicodeconflictresolver
from
Products.ERP5Type.patches
import
ZODBConnection
...
...
product/ERP5Type/patches/make_hidden_input.py
deleted
100644 → 0
View file @
2042bdf4
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""
Close properly the <input /> tag
"""
import
ZTUtils.Zope
from
ZTUtils.Zope
import
complex_marshal
from
Products.PythonScripts.standard
import
html_quote
from
Products.ERP5Type.Utils
import
ensure_list
def
make_hidden_input
(
*
args
,
**
kwargs
):
'''Construct a set of hidden input elements, with marshalling markup.
If there are positional arguments, they must be dictionaries.
They are combined with the dictionary of keyword arguments to form
a dictionary of query names and values.
Query names (the keys) must be strings. Values may be strings,
integers, floats, or DateTimes, and they may also be lists or
namespaces containing these types. All arguments are marshalled with
complex_marshal().
'''
d
=
{}
for
arg
in
args
:
d
.
update
(
arg
)
d
.
update
(
kwargs
)
hq
=
lambda
x
:
html_quote
(
x
)
qlist
=
complex_marshal
(
ensure_list
(
d
.
items
()))
for
i
in
range
(
len
(
qlist
)):
k
,
m
,
v
=
qlist
[
i
]
qlist
[
i
]
=
(
'<input type="hidden" name="%s%s" value="%s" />'
%
(
hq
(
k
),
m
,
hq
(
str
(
v
))))
return
'
\
n
'
.
join
(
qlist
)
ZTUtils
.
Zope
.
make_hidden_input
=
make_hidden_input
ZTUtils
.
make_hidden_input
=
make_hidden_input
product/ERP5Type/tests/ERP5TypeTestCase.py
View file @
c9bf1d3d
...
...
@@ -597,26 +597,9 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
bt5_path_list
+=
[
os
.
path
.
join
(
path
,
"*"
)
for
path
in
bt5_path_list
]
def
search
(
path
,
template
):
parsed_url
=
six
.
moves
.
urllib
.
parse
.
urlparse
(
path
+
'/'
+
template
)
if
parsed_url
.
scheme
==
'http'
:
user
=
parsed_url
.
username
password
=
parsed_url
.
password
host
=
parsed_url
.
hostname
selector
=
parsed_url
.
path
h
=
http_client
.
HTTP
(
host
)
h
.
putrequest
(
'HEAD'
,
selector
)
h
.
putheader
(
'Host'
,
host
)
if
user
and
passwd
:
h
.
putheader
(
'Authorization'
,
'Basic %s'
%
base64
.
b64encode
(
str2bytes
(
'%s:%s'
%
(
user
,
passwd
))).
strip
())
h
.
endheaders
()
errcode
,
errmsg
,
headers
=
h
.
getreply
()
if
errcode
==
200
:
return
urltype
+
':'
+
url
else
:
path_list
=
glob
(
os
.
path
.
join
(
path
,
template
))
if
path_list
:
return
path_list
[
0
]
path_list
=
glob
(
os
.
path
.
join
(
path
,
template
))
if
path_list
:
return
path_list
[
0
]
not_found_list
=
[]
new_template_list
=
[]
...
...
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