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
Klaus Wölfel
erp5
Commits
9f6908ac
Commit
9f6908ac
authored
Dec 30, 2020
by
Aurel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BusinessTemplate: when installing tool, register it on the site manager
parent
01e450c1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
10 deletions
+18
-10
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+3
-0
product/ERP5/ERP5Site.py
product/ERP5/ERP5Site.py
+15
-10
No files found.
product/ERP5/Document/BusinessTemplate.py
View file @
9f6908ac
...
...
@@ -1869,6 +1869,7 @@ class ToolTemplateItem(PathTemplateItem):
def
install
(
self
,
context
,
trashbin
,
**
kw
):
""" When we install a tool that is a type provider not
registered on types tool, register it into the type provider.
We also need to register the tool on the site manager
"""
PathTemplateItem
.
install
(
self
,
context
,
trashbin
,
**
kw
)
portal
=
context
.
getPortalObject
()
...
...
@@ -1879,6 +1880,8 @@ class ToolTemplateItem(PathTemplateItem):
type_container_id
not
in
types_tool
.
type_provider_list
):
types_tool
.
type_provider_list
=
tuple
(
types_tool
.
type_provider_list
)
+
\
(
type_container_id
,)
tool_id_list
=
list
(
set
(
self
.
_objects
.
keys
())
&
set
(
portal
.
_registry_tool_id_list
))
portal
.
_registerTools
(
tool_id_list
)
def
uninstall
(
self
,
context
,
**
kw
):
""" When we uninstall a tool, unregister it from the type provider. """
...
...
product/ERP5/ERP5Site.py
View file @
9f6908ac
...
...
@@ -351,26 +351,31 @@ class ERP5Site(ResponseHeaderGenerator, FolderMixIn, PortalObjectBase, CacheCook
provided
=
ITranslationDomain
,
name
=
alias
)
_registry_tool_id_list
=
'caching_policy_manager'
,
def
_registerMissingTools
(
self
):
from
Products.CMFCore
import
interfaces
,
utils
tool_id_list
=
(
"portal_skins"
,
"portal_types"
,
"portal_membership"
,
"portal_url"
,
"portal_workflow"
)
if
(
None
in
map
(
self
.
get
,
tool_id_list
)
or
not
TransactionalResource
.
registerOnce
(
__name__
,
'site_manager'
,
self
.
id
)):
return
self
.
_registerTools
(
tool_id_list
+
self
.
_registry_tool_id_list
)
def
markRegistered
(
txn
):
global
_missing_tools_registered
_missing_tools_registered
=
self
.
id
TransactionalResource
(
tpc_finish
=
markRegistered
)
def
_registerTools
(
self
,
tool_id_list
):
from
Products.CMFCore
import
interfaces
,
utils
sm
=
self
.
_components
for
tool_id
in
tool_id_list
:
tool
=
self
[
tool_id
]
tool
=
self
.
get
(
tool_id
,
None
)
if
tool
:
tool_interface
=
utils
.
_tool_interface_registry
.
get
(
tool_id
)
if
tool_interface
is
not
None
:
# Note: already registered tools will be either:
# - updated
# - registered again after being unregistered
sm
.
registerUtility
(
aq_base
(
tool
),
tool_interface
)
def
markRegistered
(
txn
):
global
_missing_tools_registered
_missing_tools_registered
=
self
.
id
TransactionalResource
(
tpc_finish
=
markRegistered
)
# backward compatibility auto-migration
def
getSiteManager
(
self
):
...
...
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