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
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
bd89a732
Commit
bd89a732
authored
May 17, 2016
by
Jérome Perrin
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
website: do not accumulate before traversal hook when cloning web sites
parent
6263cc2b
Changes
2
Show 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 @
bd89a732
...
@@ -201,6 +201,18 @@ class WebSite(WebSection):
...
@@ -201,6 +201,18 @@ class WebSite(WebSection):
BeforeTraverse
.
registerBeforeTraverse
(
item
,
WebSiteTraversalHook
(),
handle
)
BeforeTraverse
.
registerBeforeTraverse
(
item
,
WebSiteTraversalHook
(),
handle
)
WebSection
.
manage_afterAdd
(
self
,
item
,
container
)
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'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getPermanentURLList'
)
def
getPermanentURLList
(
self
,
document
):
def
getPermanentURLList
(
self
,
document
):
"""
"""
...
...
product/ERP5/tests/testERP5Web.py
View file @
bd89a732
...
@@ -169,6 +169,33 @@ class TestERP5Web(ERP5TypeTestCase):
...
@@ -169,6 +169,33 @@ class TestERP5Web(ERP5TypeTestCase):
except
:
except
:
self
.
fail
(
'Cataloging of the Web Site failed.'
)
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
):
def
test_02_EditSimpleWebPage
(
self
):
"""
"""
Simple Case of creating a web page.
Simple Case of creating a web page.
...
...
Jérome Perrin
@jerome
mentioned in commit
ac95cf57
·
May 18, 2016
mentioned in commit
ac95cf57
mentioned in commit ac95cf571d8040b44a3d24ed34f70d6adfd8afb3
Toggle commit list
Jérome Perrin
@jerome
mentioned in commit
7188d968
·
Jun 07, 2016
mentioned in commit
7188d968
mentioned in commit 7188d96864d879a20c26d5cce2bc25084e09806b
Toggle commit 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