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
141
Merge Requests
141
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
ba57396c
Commit
ba57396c
authored
Nov 08, 2021
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Plain Diff
erp5_web&erp5_web_ui_test: do redirect when portal_skin is present
See merge request
nexedi/erp5!1502
parents
319388d6
61c39f48
Pipeline
#18217
failed with stage
in 0 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
7 deletions
+83
-7
bt5/erp5_web/DocumentTemplateItem/portal_components/document.erp5.StaticWebSection.py
...eItem/portal_components/document.erp5.StaticWebSection.py
+2
-0
bt5/erp5_web/DocumentTemplateItem/portal_components/document.erp5.WebSection.py
...emplateItem/portal_components/document.erp5.WebSection.py
+5
-2
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_redirect_assist/ERP5Site_filterParameterList.py
.../erp5_web_redirect_assist/ERP5Site_filterParameterList.py
+3
-0
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_redirect_assist/ERP5Site_filterParameterList.xml
...erp5_web_redirect_assist/ERP5Site_filterParameterList.xml
+62
-0
bt5/erp5_web_ui_test/TestTemplateItem/portal_components/test.erp5.testStaticWebSiteRedirection.py
...rtal_components/test.erp5.testStaticWebSiteRedirection.py
+6
-0
product/ERP5/Document/WebSection.py
product/ERP5/Document/WebSection.py
+5
-5
No files found.
bt5/erp5_web/DocumentTemplateItem/portal_components/document.erp5.StaticWebSection.py
View file @
ba57396c
...
@@ -102,6 +102,8 @@ class StaticWebSection(WebSection):
...
@@ -102,6 +102,8 @@ class StaticWebSection(WebSection):
except
AttributeError
:
except
AttributeError
:
raise
KeyError
(
name
)
raise
KeyError
(
name
)
def
_checkIfRenderDefaultDocument
(
self
):
return
self
.
REQUEST
.
get
(
'portal_skin'
,
None
)
or
super
(
StaticWebSection
,
self
).
_checkIfRenderDefaultDocument
()
security
.
declareProtected
(
Permissions
.
View
,
'__bobo_traverse__'
)
security
.
declareProtected
(
Permissions
.
View
,
'__bobo_traverse__'
)
def
__bobo_traverse__
(
self
,
request
,
name
):
def
__bobo_traverse__
(
self
,
request
,
name
):
...
...
bt5/erp5_web/DocumentTemplateItem/portal_components/document.erp5.WebSection.py
View file @
ba57396c
...
@@ -189,6 +189,9 @@ class WebSection(Domain, DocumentExtensibleTraversableMixin):
...
@@ -189,6 +189,9 @@ class WebSection(Domain, DocumentExtensibleTraversableMixin):
"""
"""
return
self
return
self
def
_checkIfRenderDefaultDocument
(
self
):
return
not
self
.
REQUEST
.
get
(
'editable_mode'
)
and
not
self
.
REQUEST
.
get
(
'ignore_layout'
)
# Default view display
# Default view display
security
.
declareProtected
(
Permissions
.
View
,
'__call__'
)
security
.
declareProtected
(
Permissions
.
View
,
'__call__'
)
def
__call__
(
self
):
def
__call__
(
self
):
...
@@ -217,7 +220,7 @@ class WebSection(Domain, DocumentExtensibleTraversableMixin):
...
@@ -217,7 +220,7 @@ class WebSection(Domain, DocumentExtensibleTraversableMixin):
if
self
.
REQUEST
.
get
(
self
.
web_section_key
,
MARKER
)
is
MARKER
:
if
self
.
REQUEST
.
get
(
self
.
web_section_key
,
MARKER
)
is
MARKER
:
self
.
REQUEST
[
self
.
web_section_key
]
=
self
.
getPhysicalPath
()
self
.
REQUEST
[
self
.
web_section_key
]
=
self
.
getPhysicalPath
()
self
.
REQUEST
.
set
(
'current_web_section'
,
self
)
self
.
REQUEST
.
set
(
'current_web_section'
,
self
)
if
not
self
.
REQUEST
.
get
(
'editable_mode'
)
and
not
self
.
REQUEST
.
get
(
'ignore_layout'
):
if
self
.
_checkIfRenderDefaultDocument
(
):
document
=
None
document
=
None
if
self
.
isDefaultPageDisplayed
():
if
self
.
isDefaultPageDisplayed
():
# The following could be moved to a typed based method for more flexibility
# The following could be moved to a typed based method for more flexibility
...
@@ -450,4 +453,4 @@ class WebSection(Domain, DocumentExtensibleTraversableMixin):
...
@@ -450,4 +453,4 @@ class WebSection(Domain, DocumentExtensibleTraversableMixin):
else
:
else
:
# cleanup beforeTraverse hooks that may exist after this document was cloned.
# cleanup beforeTraverse hooks that may exist after this document was cloned.
self
.
_cleanupBeforeTraverseHooks
()
self
.
_cleanupBeforeTraverseHooks
()
super
(
WebSection
,
self
).
_edit
(
**
kw
)
super
(
WebSection
,
self
).
_edit
(
**
kw
)
\ No newline at end of file
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_redirect_assist/ERP5Site_filterParameterList.py
0 → 100644
View file @
ba57396c
# Don't keep any parameters when do redirect.
# This prevent duplicated parameter in redirect_url which contains already all parameters
return
dict
()
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_redirect_assist/ERP5Site_filterParameterList.xml
0 → 100644
View file @
ba57396c
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<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_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<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>
_params
</string>
</key>
<value>
<string>
parameter_list
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Site_filterParameterList
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_ui_test/TestTemplateItem/portal_components/test.erp5.testStaticWebSiteRedirection.py
View file @
ba57396c
...
@@ -176,6 +176,12 @@ class TestStaticWebSiteRedirection(ERP5TypeTestCase):
...
@@ -176,6 +176,12 @@ class TestStaticWebSiteRedirection(ERP5TypeTestCase):
def
test_queryStringPortalSkin
(
self
):
def
test_queryStringPortalSkin
(
self
):
self
.
runTestRedirect
(
"?portal_skin=FOOBAR"
)
self
.
runTestRedirect
(
"?portal_skin=FOOBAR"
)
def
test_queryStringIgnoreLayoutWithQueryStringPortalSkin
(
self
):
self
.
runTestRedirect
(
"?portal_skin=FOOBAR&ignore_layout=1"
)
def
test_queryStringEditableModeWithQueryStringPortalSkin
(
self
):
self
.
runTestRedirect
(
"?portal_skin=FOOBAR&editable_mode=1"
)
def
test_plainRedirectGetId
(
self
):
def
test_plainRedirectGetId
(
self
):
self
.
runTestRedirect
(
"getId"
)
self
.
runTestRedirect
(
"getId"
)
...
...
product/ERP5/Document/WebSection.py
View file @
ba57396c
...
@@ -40,10 +40,10 @@ class WebSectionTraversalHook(Persistent):
...
@@ -40,10 +40,10 @@ class WebSectionTraversalHook(Persistent):
"""Traversal hook to change the skin selection for this websection.
"""Traversal hook to change the skin selection for this websection.
"""
"""
def
__call__
(
self
,
container
,
request
):
def
__call__
(
self
,
container
,
request
):
if
not
request
.
get
(
'ignore_layout'
,
None
):
portal_skin
=
request
.
get
(
'portal_skin'
,
None
)
if
(
not
request
.
get
(
'ignore_layout'
,
None
)
and
portal_skin
is
None
)
or
\
(
container
.
getPortalType
()
not
in
WEB_SECTION_PORTAL_TYPE_TUPLE
and
portal_skin
):
# If a skin selection is defined in this web section, change the skin now.
# If a skin selection is defined in this web section, change the skin now.
skin_selection_name
=
container
.
getSkinSelectionName
()
skin_selection_name
=
container
.
getSkinSelectionName
()
if
skin_selection_name
and
\
if
skin_selection_name
:
((
request
.
get
(
'portal_skin'
,
None
)
is
None
)
or
\
container
.
getPortalObject
().
changeSkin
(
skin_selection_name
)
container
.
getPortalType
()
not
in
WEB_SECTION_PORTAL_TYPE_TUPLE
):
container
.
getPortalObject
().
changeSkin
(
skin_selection_name
)
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