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
Léo-Paul Géneau
erp5
Commits
b91d40f6
Commit
b91d40f6
authored
May 17, 2016
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
website: do not accumulate before traversal hook when cloning web sites
parent
0434841f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
+39
-0
product/ERP5/Document/WebSite.py
product/ERP5/Document/WebSite.py
+12
-0
product/ERP5/tests/testERP5Web.py
product/ERP5/tests/testERP5Web.py
+27
-0
No files found.
product/ERP5/Document/WebSite.py
View file @
b91d40f6
...
...
@@ -201,6 +201,18 @@ class WebSite(WebSection):
BeforeTraverse
.
registerBeforeTraverse
(
item
,
WebSiteTraversalHook
(),
handle
)
WebSection
.
manage_afterAdd
(
self
,
item
,
container
)
security
.
declarePrivate
(
'manage_afterClone'
)
def
manage_afterClone
(
self
,
item
):
# unregister all before traversal hooks that do not belong to us.
my_handle
=
self
.
meta_type
+
'/'
+
self
.
getId
()
handle_to_unregister_list
=
[]
for
priority
,
handle
in
self
.
__before_traverse__
.
keys
():
if
handle
!=
my_handle
:
handle_to_unregister_list
.
append
(
handle
)
for
handle
in
handle_to_unregister_list
:
BeforeTraverse
.
unregisterBeforeTraverse
(
self
,
handle
)
WebSection
.
manage_afterClone
(
self
,
item
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getPermanentURLList'
)
def
getPermanentURLList
(
self
,
document
):
"""
...
...
product/ERP5/tests/testERP5Web.py
View file @
b91d40f6
...
...
@@ -169,6 +169,33 @@ class TestERP5Web(ERP5TypeTestCase):
except
:
self
.
fail
(
'Cataloging of the Web Site failed.'
)
def
test_WebSiteTraversalHook_on_newContent
(
self
):
"""a WebSiteTraversalHook is added on websites automatically.
"""
web_site
=
self
.
portal
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
)
self
.
assertEquals
(
1
,
len
(
web_site
.
__before_traverse__
))
def
test_WebSiteTraversalHook_on_clone
(
self
):
"""a WebSiteTraversalHook is correctly updated after cloning a website.
"""
web_site
=
self
.
portal
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
)
cloned_web_site
=
web_site
.
Base_createCloneDocument
(
batch_mode
=
True
)
self
.
assertEquals
(
1
,
len
(
cloned_web_site
.
__before_traverse__
))
def
test_WebSiteTraversalHook_on_change_id
(
self
):
"""a WebSiteTraversalHook is correctly updated after changing website id.
"""
web_site
=
self
.
portal
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
)
self
.
tic
()
web_site
.
setId
(
"new_id"
)
self
.
assertEquals
(
1
,
len
(
web_site
.
__before_traverse__
))
def
test_02_EditSimpleWebPage
(
self
):
"""
Simple Case of creating a web page.
...
...
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