Commit b36d4e11 authored by Stefan H. Holek's avatar Stefan H. Holek

hasPackage consulted the wrong registry, oops.

parent cf0a8834
...@@ -168,7 +168,7 @@ def installProduct(name, quiet=0): ...@@ -168,7 +168,7 @@ def installProduct(name, quiet=0):
def hasPackage(name): def hasPackage(name):
'''Checks if a package has been registered with five:registerPackage.''' '''Checks if a package has been registered with five:registerPackage.'''
return name in [m.__name__ for m, f in Products._packages_to_initialize] return name in [m.__name__ for m in getattr(Products, '_registered_packages', [])]
def installPackage(name, quiet=0): def installPackage(name, quiet=0):
'''Installs a registered Python package like a Zope product.''' '''Installs a registered Python package like a Zope product.'''
......
...@@ -74,6 +74,11 @@ def testInstallPackage(): ...@@ -74,6 +74,11 @@ def testInstallPackage():
True True
>>> ZopeTestCase.close(app) >>> ZopeTestCase.close(app)
hasPackage still returns True
>>> ZopeTestCase.hasPackage('testpackage')
True
Clean up Clean up
>>> import testpackage >>> import testpackage
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment