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
Carlos Ramos Carreño
erp5
Commits
44ce2448
Commit
44ce2448
authored
Sep 07, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into zope4py2
parents
d580c7e0
d8fb4c62
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
335 additions
and
2 deletions
+335
-2
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/view_main.zpt
...plateItem/portal_skins/erp5_web_js_style_ui/view_main.zpt
+21
-0
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleDoubleReferenceTraversal.xml
...ts/js_style_zuite/testJsStyleDoubleReferenceTraversal.xml
+58
-0
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleDoubleReferenceTraversal.zpt
...ts/js_style_zuite/testJsStyleDoubleReferenceTraversal.zpt
+95
-0
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleWebSectionSiblingTraversal.xml
.../js_style_zuite/testJsStyleWebSectionSiblingTraversal.xml
+58
-0
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleWebSectionSiblingTraversal.zpt
.../js_style_zuite/testJsStyleWebSectionSiblingTraversal.zpt
+95
-0
product/ERP5Type/Core/Folder.py
product/ERP5Type/Core/Folder.py
+1
-1
product/ERP5Type/tests/testERP5Type.py
product/ERP5Type/tests/testERP5Type.py
+7
-1
No files found.
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/view_main.zpt
View file @
44ce2448
...
...
@@ -9,6 +9,8 @@
dummy python: request.set('editable_mode', False);
web_site python: here.getWebSiteValue();
web_section python: here.getWebSectionValue();
is_unexpected_reference_access python: '/' in here.getRelativeUrl()[len(web_section.getRelativeUrl()) + 1:];
is_unexpected_acquisition_access python: (web_section.getParentValue().getRelativeUrl() != web_section.aq_parent.getRelativeUrl()) or (web_site.getParentValue().getRelativeUrl() != web_site.aq_parent.getRelativeUrl());
relative_url_prefix python: web_section.WebSection_generateRelativeUrlPrefix();
no_style_gadget_url python: web_section.WebSection_generateLayoutPropertyUrl('configuration_style_gadget_url');
no_style_css_url python: relative_url_prefix + 'jsstyle.css';
...
...
@@ -23,6 +25,24 @@
current_language python: web_site.getPortalObject().Localizer.get_selected_language();
global_definitions_macros here/global_definitions/macros;
include_document python: web_section.isSiteMapDocumentParent() and ((here.getRelativeUrl() == web_section.getRelativeUrl()) or request.get('is_web_section_default_document', False));"
>
<tal:block
tal:condition=
"python: is_unexpected_reference_access"
>
<tal:block
metal:use-macro=
"context/error_main/macros/master"
>
<metal:slot
metal:fill-slot=
"main"
i18n:domain=
"erp5_ui"
>
<h2
i18n:translate=
""
tal:define=
"dummy python: request.response.setStatus(404);"
>
Unexpected URL
</h2>
<p
i18n:translate=
""
>
The URL path only accept a single document reference.
</p>
</metal:slot>
</tal:block>
</tal:block>
<tal:block
tal:condition=
"python: is_unexpected_acquisition_access"
>
<tal:block
metal:use-macro=
"context/error_main/macros/master"
>
<metal:slot
metal:fill-slot=
"main"
i18n:domain=
"erp5_ui"
>
<h2
i18n:translate=
""
tal:define=
"dummy python: request.response.setStatus(404);"
>
Unexpected URL
</h2>
<p
i18n:translate=
""
>
The URL should not rely on ID acquisition.
</p>
</metal:slot>
</tal:block>
</tal:block>
<tal:block
tal:condition=
"python: not (is_unexpected_reference_access or is_unexpected_acquisition_access)"
>
<tal:block
metal:use-macro=
"global_definitions_macros/header_definitions"
/>
<!DOCTYPE html>
<html
tal:attributes=
"lang current_language"
>
...
...
@@ -91,3 +111,4 @@
</tal:block>
</tal:block>
</tal:block>
\ No newline at end of file
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleDoubleReferenceTraversal.xml
0 → 100644
View file @
44ce2448
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ZopePageTemplate"
module=
"Products.PageTemplates.ZopePageTemplate"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
expand
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
testJsStyleDoubleReferenceTraversal
</string>
</value>
</item>
<item>
<key>
<string>
output_encoding
</string>
</key>
<value>
<string>
utf-8
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<unicode></unicode>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleDoubleReferenceTraversal.zpt
0 → 100644
View file @
44ce2448
<html
xmlns:tal=
"http://xml.zope.org/namespaces/tal"
xmlns:metal=
"http://xml.zope.org/namespaces/metal"
>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
<title>
Test JS Style No Style
</title>
</head>
<body>
<table
cellpadding=
"1"
cellspacing=
"1"
border=
"1"
>
<thead>
<tr><td
rowspan=
"1"
colspan=
"3"
>
Test JS Style No Style
</td></tr>
</thead><tbody>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplate/macros/init"
/>
<tr>
<td>
open
</td>
<td>
${base_url}/ERP5Site_createWebJSStyleZuiteTestData?configuration=nostyle
</td>
<td></td>
</tr>
<tr>
<td>
assertTextPresent
</td>
<td>
Web Site created.
</td>
<td></td>
</tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplate/macros/wait_for_activities"
/>
<!-- Initialize -->
<tr>
<td>
open
</td>
<td>
${base_url}/web_site_module/erp5_web_js_style_test_site/erp5_web_js_style_test_contentpage/erp5_web_js_style_test_frontpage
</td>
<td></td>
</tr>
<tr>
<td>
assertElementNotPresent
</td>
<td>
//head/link[@rel='prerender']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementNotPresent
</td>
<td>
//head/link[@rel='alternate' and @type='application/rss+xml' and @href='feed.rss']
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//head/link[@rel='stylesheet' and @href='jsstyle.css']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//head/link[@rel='stylesheet' and @href='jsstyle.css']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//nav[@id='sitemap']/a[text()='No Style']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//nav[@id='language']//a[@hreflang='en']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementNotPresent
</td>
<td>
//aside[@id='document_list']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementNotPresent
</td>
<td>
//div[@class='input']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//main//h2[text()='Unexpected URL']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//main//p[text()='The URL path only accept a single document reference.']
</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleWebSectionSiblingTraversal.xml
0 → 100644
View file @
44ce2448
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ZopePageTemplate"
module=
"Products.PageTemplates.ZopePageTemplate"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
expand
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
testJsStyleWebSectionSiblingTraversal
</string>
</value>
</item>
<item>
<key>
<string>
output_encoding
</string>
</key>
<value>
<string>
utf-8
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<unicode></unicode>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleWebSectionSiblingTraversal.zpt
0 → 100644
View file @
44ce2448
<html
xmlns:tal=
"http://xml.zope.org/namespaces/tal"
xmlns:metal=
"http://xml.zope.org/namespaces/metal"
>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
<title>
Test JS Style No Style
</title>
</head>
<body>
<table
cellpadding=
"1"
cellspacing=
"1"
border=
"1"
>
<thead>
<tr><td
rowspan=
"1"
colspan=
"3"
>
Test JS Style No Style
</td></tr>
</thead><tbody>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplate/macros/init"
/>
<tr>
<td>
open
</td>
<td>
${base_url}/ERP5Site_createWebJSStyleZuiteTestData?configuration=nostyle
</td>
<td></td>
</tr>
<tr>
<td>
assertTextPresent
</td>
<td>
Web Site created.
</td>
<td></td>
</tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplate/macros/wait_for_activities"
/>
<!-- Initialize -->
<tr>
<td>
open
</td>
<td>
${base_url}/web_site_module/erp5_web_js_style_test_site//erp5_web_js_style_test_section_1/erp5_web_js_style_test_section_2/
</td>
<td></td>
</tr>
<tr>
<td>
assertElementNotPresent
</td>
<td>
//head/link[@rel='prerender']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementNotPresent
</td>
<td>
//head/link[@rel='alternate' and @type='application/rss+xml' and @href='feed.rss']
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//head/link[@rel='stylesheet' and @href='jsstyle.css']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//head/link[@rel='stylesheet' and @href='jsstyle.css']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//nav[@id='sitemap']/a[text()='No Style']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//nav[@id='language']//a[@hreflang='en']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementNotPresent
</td>
<td>
//aside[@id='document_list']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementNotPresent
</td>
<td>
//div[@class='input']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//main//h2[text()='Unexpected URL']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//main//p[text()='The URL should not rely on ID acquisition.']
</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
product/ERP5Type/Core/Folder.py
View file @
44ce2448
...
...
@@ -1542,7 +1542,7 @@ class Folder(FolderMixIn, CopyContainer, ObjectManager, Base, OFSFolder2, CMFBTr
if
portal_type
is
not
None
:
if
isinstance
(
portal_type
,
str
):
portal_type
=
(
portal_type
,)
object_list
=
[
x
for
x
in
object_list
if
x
.
getPortalType
()
in
portal_type
]
object_list
=
[
x
for
x
in
object_list
if
getattr
(
aq_base
(
x
),
'getPortalType'
,
lambda
:
None
)
()
in
portal_type
]
if
checked_permission
is
not
None
:
checkPermission
=
getSecurityManager
().
checkPermission
object_list
=
[
o
for
o
in
object_list
...
...
product/ERP5Type/tests/testERP5Type.py
View file @
44ce2448
...
...
@@ -37,7 +37,7 @@ import warnings
from
Acquisition
import
aq_base
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
AccessControl.ZopeGuards
import
guarded_import
from
Products.ERP5Type.tests.utils
import
LogInterceptor
from
Products.ERP5Type.tests.utils
import
LogInterceptor
,
createZODBPythonScript
class
TestERP5Type
(
ERP5TypeTestCase
,
LogInterceptor
):
"""
...
...
@@ -283,6 +283,12 @@ class TestERP5Type(ERP5TypeTestCase, LogInterceptor):
warnings
.
warn
(
'user warning'
,
DeprecationWarning
)
self
.
assertEqual
(
self
.
logged
[
-
1
].
name
,
'DeprecationWarning'
)
def
test_objectValues
(
self
):
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
)
createZODBPythonScript
(
person
,
'script'
,
''
,
''
)
script
=
person
[
'script'
]
self
.
assertIn
(
script
,
person
.
objectValues
())
self
.
assertNotIn
(
script
,
person
.
objectValues
(
portal_type
=
'Person'
))
def
test_suite
():
suite
=
unittest
.
TestSuite
()
...
...
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