Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush Tiwari
erp5
Commits
2f06c766
Commit
2f06c766
authored
May 17, 2016
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
website: cleanup old before traverse hooks that may exist on website
parent
b91d40f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
product/ERP5/Document/WebSite.py
product/ERP5/Document/WebSite.py
+14
-7
No files found.
product/ERP5/Document/WebSite.py
View file @
2f06c766
...
@@ -203,15 +203,18 @@ class WebSite(WebSection):
...
@@ -203,15 +203,18 @@ class WebSite(WebSection):
security
.
declarePrivate
(
'manage_afterClone'
)
security
.
declarePrivate
(
'manage_afterClone'
)
def
manage_afterClone
(
self
,
item
):
def
manage_afterClone
(
self
,
item
):
self
.
_cleanupBeforeTraverseHooks
()
WebSection
.
manage_afterClone
(
self
,
item
)
def
_cleanupBeforeTraverseHooks
(
self
):
# unregister all before traversal hooks that do not belong to us.
# unregister all before traversal hooks that do not belong to us.
my_handle
=
self
.
meta_type
+
'/'
+
self
.
getId
()
my_handle
=
self
.
meta_type
+
'/'
+
self
.
getId
()
handle_to_unregister_list
=
[]
handle_to_unregister_list
=
[]
for
priority
,
handle
in
self
.
__before_traverse__
.
key
s
():
for
(
priority
,
handle
),
hook
in
self
.
__before_traverse__
.
item
s
():
if
handle
!=
my_handle
:
if
isinstance
(
hook
,
WebSiteTraversalHook
)
and
handle
!=
my_handle
:
handle_to_unregister_list
.
append
(
handle
)
handle_to_unregister_list
.
append
(
handle
)
for
handle
in
handle_to_unregister_list
:
for
handle
in
handle_to_unregister_list
:
BeforeTraverse
.
unregisterBeforeTraverse
(
self
,
handle
)
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
):
...
@@ -278,8 +281,12 @@ class WebSite(WebSection):
...
@@ -278,8 +281,12 @@ class WebSite(WebSection):
return
[]
return
[]
def
_edit
(
self
,
**
kw
):
def
_edit
(
self
,
**
kw
):
# migrate beforeTraverse hook if missing
if
self
.
getPortalType
()
==
'Web Site'
:
if
getattr
(
self
,
'__before_traverse__'
,
None
)
is
None
and
self
.
getPortalType
()
==
'Web Site'
:
if
getattr
(
self
,
'__before_traverse__'
,
None
)
is
None
:
handle
=
self
.
meta_type
+
'/'
+
self
.
getId
()
# migrate beforeTraverse hook if missing
BeforeTraverse
.
registerBeforeTraverse
(
self
,
WebSiteTraversalHook
(),
handle
)
handle
=
self
.
meta_type
+
'/'
+
self
.
getId
()
BeforeTraverse
.
registerBeforeTraverse
(
self
,
WebSiteTraversalHook
(),
handle
)
else
:
# cleanup beforeTraverse hooks that may exist after this document was cloned.
self
.
_cleanupBeforeTraverseHooks
()
super
(
WebSite
,
self
).
_edit
(
**
kw
)
super
(
WebSite
,
self
).
_edit
(
**
kw
)
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