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
ad5594ae
Commit
ad5594ae
authored
Jun 27, 2010
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the API complete by offering a has_package
parent
3839e80a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
7 deletions
+12
-7
doc/CHANGES.rst
doc/CHANGES.rst
+3
-2
src/OFS/metaconfigure.py
src/OFS/metaconfigure.py
+4
-0
src/OFS/tests/test_registerpackage.py
src/OFS/tests/test_registerpackage.py
+3
-3
src/Testing/ZopeTestCase/ZopeLite.py
src/Testing/ZopeTestCase/ZopeLite.py
+2
-2
No files found.
doc/CHANGES.rst
View file @
ad5594ae
...
...
@@ -18,8 +18,9 @@ Bugs Fixed
Features Added
++++++++++++++
- Added a new API to ``OFS.metaconfigure.get_registered_packages`` which
replaces any direct access to ``Products._registered_packages``.
- Added a new API's ``get_registered_packages, set_registered_packages`` to
``OFS.metaconfigure`` which replace any direct access to
``Products._registered_packages``.
- Changed product install so it won't write persistent changes only to abort
them. Instead we don't make any database changes in the first place.
...
...
src/OFS/metaconfigure.py
View file @
ad5594ae
...
...
@@ -82,6 +82,10 @@ def set_registered_packages(packages):
_registered_packages
=
packages
def
has_package
(
package
):
return
package
in
[
m
.
__name__
for
m
in
get_registered_packages
()]
def
_registerPackage
(
module_
,
init_func
=
None
):
"""Registers the given python package as a Zope 2 style product
"""
...
...
src/OFS/tests/test_registerpackage.py
View file @
ad5594ae
...
...
@@ -58,9 +58,9 @@ def test_registerPackage():
Make sure it is registered:
>>> from OFS.metaconfigure import
get_registered_packages
>>>
[x.__name__ for x in get_registered_packages()]
['pythonproduct2']
>>> from OFS.metaconfigure import
has_package
>>>
has_package('pythonproduct2')
True
Clean up:
...
...
src/Testing/ZopeTestCase/ZopeLite.py
View file @
ad5594ae
...
...
@@ -191,8 +191,8 @@ def _installProduct(name, quiet=0):
def
hasPackage
(
name
):
'''Checks if a package has been registered with five:registerPackage.'''
from
OFS.metaconfigure
import
get_registered_packages
return
name
in
[
m
.
__name__
for
m
in
get_registered_packages
()]
from
OFS.metaconfigure
import
has_package
return
has_package
(
name
)
def
installPackage
(
name
,
quiet
=
0
):
'''Installs a registered Python package.'''
...
...
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