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
23fc3d3f
Commit
23fc3d3f
authored
Nov 22, 2017
by
Ayush Tiwari
Committed by
Ayush Tiwari
Apr 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Site: Update bootstrap of ERP5Site with new BMs
parent
931ddbf1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
26 deletions
+90
-26
product/ERP5/ERP5Site.py
product/ERP5/ERP5Site.py
+69
-8
product/ERP5Type/Tool/PropertySheetTool.py
product/ERP5Type/Tool/PropertySheetTool.py
+10
-10
product/ERP5Type/Tool/TypesTool.py
product/ERP5Type/Tool/TypesTool.py
+11
-8
No files found.
product/ERP5/ERP5Site.py
View file @
23fc3d3f
...
...
@@ -242,6 +242,7 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
# installed, and scalability tests want a reliable way to know when the site
# is ready to be tortured.
isPortalBeingCreated
=
ConstantGetter
(
'isPortalBeingCreated'
,
value
=
False
)
isIndexingRequired
=
ConstantGetter
(
'isIndexingRequired'
,
value
=
True
)
_properties
=
(
{
'id'
:
'title'
,
...
...
@@ -1959,6 +1960,35 @@ class ERP5Generator(PortalGenerator):
return
p
@
classmethod
def
bootstrap_bm
(
cls
,
context
,
bm_name
,
path_list
):
"""
Bootstrap Business Item from the paths needed
"""
bm_path
=
getBootstrapBusinessTemplateUrl
(
bm_name
)
portal
=
context
.
getPortalObject
()
try
:
# If template_tool doesn't exist, do nothing
template_tool
=
portal
.
portal_templates
pt
=
portal
.
portal_types
# Create dynamic_class for Business Manager if it doesn't exist in
# portal_types
if
pt
.
getTypeInfo
(
'Business Manager'
)
is
None
:
import
erp5
BusinessManager
=
getattr
(
erp5
.
portal_type
,
'Business Manager'
)
BusinessManager
.
loadClass
()
manager
=
BusinessManager
(
id
=
'bootstrap_bm'
)
connection
=
pt
.
_p_jar
else
:
manager
=
template_tool
.
newContent
(
portal_type
=
'Business Manager'
)
connection
=
None
manager
.
importFile
(
bm_path
+
'/'
+
bm_name
+
'.zexp'
,
connection
)
for
path
in
path_list
:
item
=
manager
.
getBusinessItemByPath
(
path
)
item
.
install
(
manager
,
portal
)
except
AttributeError
:
pass
@
classmethod
def
bootstrap
(
cls
,
context
,
bt_name
,
item_name
,
content_id_list
):
bt_path
=
getBootstrapBusinessTemplateUrl
(
bt_name
)
...
...
@@ -1983,9 +2013,9 @@ class ERP5Generator(PortalGenerator):
def
bootstrap_allow_type
(
types_tool
,
portal_type
):
from
xml.etree.cElementTree
import
parse
bt_path
=
getBootstrapBusinessTemplateUrl
(
'erp5_core'
)
types_tool
[
portal_type
].
allowed_content_types
=
[
x
.
text
for
x
in
parse
(
setattr
(
types_tool
[
portal_type
],
'allowed_content_types'
,(
[
x
.
text
for
x
in
parse
(
os
.
path
.
join
(
bt_path
,
'PortalTypeAllowedContentTypeTemplateItem'
,
'allowed_content_types.xml'
)
).
iterfind
(
"portal_type[@id='%s']/*"
%
portal_type
)]
).
iterfind
(
"portal_type[@id='%s']/*"
%
portal_type
)]
))
def
setupLastTools
(
self
,
p
,
**
kw
):
"""
...
...
@@ -2053,7 +2083,7 @@ class ERP5Generator(PortalGenerator):
addERP5Tool
(
p
,
'portal_memcached'
,
'Memcached Tool'
)
# Add erp5 catalog tool
addERP5Tool
(
p
,
'portal_catalog'
,
'Catalog Tool'
)
addERP5Tool
(
p
,
'portal_catalog'
,
'
ERP5
Catalog Tool'
)
sql_reset
=
kw
.
get
(
'sql_reset'
,
0
)
def
addSQLConnection
(
id
,
title
,
**
kw
):
...
...
@@ -2198,10 +2228,21 @@ class ERP5Generator(PortalGenerator):
"""
workflow_list
=
[
'business_template_building_workflow'
,
'business_template_installation_workflow'
]
manager_workflow_list
=
[
'business_manager_building_workflow'
,
'business_manager_installation_workflow'
]
tool
=
p
.
portal_workflow
tool
.
manage_delObjects
(
filter
(
tool
.
hasObject
,
manager_workflow_list
))
tool
.
manage_delObjects
(
filter
(
tool
.
hasObject
,
workflow_list
))
self
.
bootstrap
(
tool
,
'erp5_core'
,
'WorkflowTemplateItem'
,
workflow_list
)
tool
.
setChainForPortalTypes
((
'Business Template'
,),
workflow_list
)
self
.
bootstrap_bm
(
tool
,
'erp5_core'
,
(
'portal_workflow/business_template_installation_workflow'
,
'portal_workflow/business_template_building_workflow'
,
'portal_types/Business Template#type_workflow_list'
,
))
self
.
bootstrap
(
tool
,
'erp5_business_package'
,
'WorkflowTemplateItem'
,
(
'business_manager_building_workflow'
,
'business_manager_installation_workflow'
,
))
tool
.
setChainForPortalTypes
((
'Business Manager'
,),
manager_workflow_list
)
def
setupIndex
(
self
,
p
,
**
kw
):
# Make sure all tools and folders have been indexed
...
...
@@ -2326,9 +2367,17 @@ class ERP5Generator(PortalGenerator):
if
not
p
.
hasObject
(
'content_type_registry'
):
self
.
setupMimetypes
(
p
)
# Explicitly run bootstrap for portal_types and portal_property_sheets
# before installing bootstrap Business Template/Manager becuase it needs to
# be there for bootstrap portal_types and property_sheets to be used.
p
.
portal_types
.
_bootstrap
()
p
.
portal_property_sheets
.
_bootstrap
()
if
not
update
:
self
.
setupWorkflow
(
p
)
self
.
setupERP5Core
(
p
,
**
kw
)
# XXX: Force setting of properties setter and getters after bootstrap
p
.
portal_types
.
resetDynamicDocuments
()
self
.
setupERP5Promise
(
p
,
**
kw
)
# Make sure the cache is initialized
...
...
@@ -2347,13 +2396,25 @@ class ERP5Generator(PortalGenerator):
"""
template_tool
=
p
.
portal_templates
if
template_tool
.
getInstalledBusinessTemplate
(
'erp5_core'
)
is
None
:
for
bt
in
(
'erp5_
property_sheets'
,
'erp5_core'
,
p
.
erp5_catalog_storage
,
'erp5_jquery
'
,
'erp5_xhtml_style'
):
for
bt
in
(
'erp5_
core'
,
'erp5_business_package'
,
'erp5_property_sheets
'
,
):
if
not
bt
:
continue
url
=
getBootstrapBusinessTemplateUrl
(
bt
)
bt
=
template_tool
.
download
(
url
)
bt
.
install
(
**
kw
)
if
bt
.
getPortalType
()
==
'Business Manager'
:
template_tool
.
updateInstallationState
([
bt
])
else
:
bt
.
install
(
**
kw
)
bt_list
=
[]
for
bt
in
(
p
.
erp5_catalog_storage
,
'erp5_jquery'
,
'erp5_xhtml_style'
,):
url
=
getBootstrapBusinessTemplateUrl
(
bt
)
bt
=
template_tool
.
download
(
url
)
bt_list
.
append
(
bt
)
template_tool
.
updateInstallationState
(
bt_list
)
def
setupERP5Promise
(
self
,
p
,
**
kw
):
"""
...
...
product/ERP5Type/Tool/PropertySheetTool.py
View file @
23fc3d3f
...
...
@@ -62,17 +62,17 @@ class PropertySheetTool(BaseTool):
def
_bootstrap
(
self
):
bt_name
=
'erp5_property_sheets'
from
Products.ERP5.ERP5Site
import
ERP5Generator
ERP5Generator
.
bootstrap
(
self
,
bt_name
,
'PropertySheetTemplateItem'
,
(
'BaseType'
,
'BusinessTemplate'
,
'Folder'
,
'SimpleItem'
,
'Version'
,
'Comment'
,
ERP5Generator
.
bootstrap
_bm
(
self
,
bt_name
,
(
'
portal_property_sheets/
BaseType'
,
'
portal_property_sheets/
BusinessTemplate'
,
'
portal_property_sheets/
Folder'
,
'
portal_property_sheets/
SimpleItem'
,
'
portal_property_sheets/
Version'
,
'
portal_property_sheets/
Comment'
,
# the following ones are required to upgrade an existing site
'Reference'
,
'BaseCategory'
,
'SQLIdGenerator'
,
'
portal_property_sheets/
Reference'
,
'
portal_property_sheets/
BaseCategory'
,
'
portal_property_sheets/
SQLIdGenerator'
,
))
def
install
():
from
ZPublisher.BaseRequest
import
RequestContainer
...
...
product/ERP5Type/Tool/TypesTool.py
View file @
23fc3d3f
...
...
@@ -124,16 +124,19 @@ class TypesTool(TypeProvider):
def
_bootstrap
(
self
):
from
Products.ERP5.ERP5Site
import
ERP5Generator
ERP5Generator
.
bootstrap
(
self
,
'erp5_core'
,
'PortalTypeTemplateItem
'
,
(
'Business Template'
,
'Standard Property'
,
'Acquired Property'
,
ERP5Generator
.
bootstrap
_bm
(
self
,
'erp5_core
'
,
(
'
portal_types/
Business Template'
,
'
portal_types/
Standard Property'
,
'
portal_types/
Acquired Property'
,
# the following ones are required to upgrade an existing site
'Category Property'
,
# the following is needed to bootstrap Catalog Tool and default catalog
'Catalog Tool'
,
'portal_types/Category Property'
,
))
# Bootstrap Business Manager as it'll be needed while installation
ERP5Generator
.
bootstrap
(
self
,
'erp5_business_package'
,
'PortalTypeTemplateItem'
,
(
'Business Manager'
,
'Business Item'
,
'Business Property Item'
))
ERP5Generator
.
bootstrap_allow_type
(
self
,
'Catalog Tool'
)
def
listContentTypes
(
self
,
container
=
None
):
"""List content types from all providers
...
...
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