Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
97851f8e
Commit
97851f8e
authored
Jun 23, 2007
by
Stefan H. Holek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract package installation code into its own function so it can be reused.
parent
22a4ad24
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
15 deletions
+31
-15
lib/python/OFS/Application.py
lib/python/OFS/Application.py
+31
-15
No files found.
lib/python/OFS/Application.py
View file @
97851f8e
...
...
@@ -633,21 +633,9 @@ def install_products(app):
install_product
(
app
,
product_dir
,
product_name
,
meta_types
,
folder_permissions
,
raise_exc
=
debug_mode
)
# Delayed install of products-as-packages
for
module_
,
init_func
in
getattr
(
Products
,
'_packages_to_initialize'
,
[]):
try
:
product
=
App
.
Product
.
initializeProduct
(
module_
,
module_
.
__name__
,
module_
.
__path__
[
0
],
app
)
product
.
package_name
=
module_
.
__name__
if
init_func
is
not
None
:
newContext
=
ProductContext
(
product
,
app
,
module_
)
init_func
(
newContext
)
finally
:
transaction
.
commit
()
# Delayed install of packages-as-products
for
module
,
init_func
in
Products
.
_packages_to_initialize
:
install_package
(
app
,
module
,
init_func
,
raise_exc
=
debug_mode
)
Products
.
_packages_to_initialize
=
[]
Products
.
meta_types
=
Products
.
meta_types
+
tuple
(
meta_types
)
...
...
@@ -878,6 +866,34 @@ def install_product(app, product_dir, product_name, meta_types,
if
raise_exc
:
raise
def
install_package
(
app
,
module
,
init_func
,
raise_exc
=
False
,
log_exc
=
True
):
"""Installs a Python package like a product."""
try
:
product
=
App
.
Product
.
initializeProduct
(
module
,
module
.
__name__
,
module
.
__path__
[
0
],
app
)
product
.
package_name
=
module
.
__name__
if
init_func
is
not
None
:
newContext
=
ProductContext
(
product
,
app
,
module
)
init_func
(
newContext
)
if
not
doInstall
():
transaction
.
abort
()
else
:
transaction
.
get
().
note
(
'Installed package %s'
%
module
.
__name__
)
transaction
.
commit
()
except
:
if
log_exc
:
LOG
.
error
(
"Couldn't install %s"
%
module
.
__name__
,
exc_info
=
True
)
transaction
.
abort
()
if
raise_exc
:
raise
def
install_standards
(
app
):
# Check to see if we've already done this before
# Don't do it twice (Casey)
...
...
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