[Checkins] SVN: z3ext.product/tags/1.2.1/ release tag
Nikolay Kim
fafhrd at datacom.kz
Mon Sep 29 16:20:20 EDT 2008
Log message for revision 91628:
release tag
Changed:
A z3ext.product/tags/1.2.1/
D z3ext.product/tags/1.2.1/CHANGES.txt
A z3ext.product/tags/1.2.1/CHANGES.txt
U z3ext.product/tags/1.2.1/setup.py
D z3ext.product/tags/1.2.1/src/z3ext/product/README.txt
A z3ext.product/tags/1.2.1/src/z3ext/product/README.txt
A z3ext.product/tags/1.2.1/src/z3ext/product/enclosed.txt
D z3ext.product/tags/1.2.1/src/z3ext/product/product.py
A z3ext.product/tags/1.2.1/src/z3ext/product/product.py
D z3ext.product/tags/1.2.1/src/z3ext/product/tests.py
A z3ext.product/tags/1.2.1/src/z3ext/product/tests.py
-=-
Copied: z3ext.product/tags/1.2.1 (from rev 91481, z3ext.product/trunk)
Deleted: z3ext.product/tags/1.2.1/CHANGES.txt
===================================================================
--- z3ext.product/trunk/CHANGES.txt 2008-09-25 13:28:26 UTC (rev 91481)
+++ z3ext.product/tags/1.2.1/CHANGES.txt 2008-09-29 20:20:19 UTC (rev 91628)
@@ -1,78 +0,0 @@
-=======
-CHANGES
-=======
-
-
-1.2.0 (2008-09-04)
-------------------
-
-- Added product dependencies (require attribute)
-
-
-1.1.2 (2008-08-13)
-------------------
-
-- Calculate installed status
-
-
-1.1.0 (2008-08-05)
-------------------
-
-- Implemented product management for enclosed site objects
-
-
-1.0.2 (2008-05-26)
-------------------
-
-- During product instalation, first install CA registry, then call update
-
-
-1.0.1 (2008-05-15)
-------------------
-
-- Compatibility with z3ext.controlpanel >= 1.2.3
-
-
-1.0.0 (2008-03-26)
-------------------
-
-- Tests added
-
-- Code moved to svn.zope.org
-
-
-0.11.1 (2008-03-04)
--------------------
-
-- Added 'broken' base registry in case product not available.
-
-
-0.11 (2008-02-28)
------------------
-
-- Use z3c.baseregistry
-
-- Use z3c.autoinclude
-
-- Create components registry for each product.
- now it's possible to use <registerIn registry="z3ext.product.productName'/>
- for registering product adapters and utulities.
-
-
-0.10.2 (2008-02-18)
-------------------
-
-- Don't show 'Products Management' configlet
- if there are no installable products
-
-
-0.10.1 (2008-02-01)
-------------------
-
-- Removed `grant` directives
-
-
-0.10 (2008-02-01)
-------------------
-
-- Initial release
Copied: z3ext.product/tags/1.2.1/CHANGES.txt (from rev 91627, z3ext.product/trunk/CHANGES.txt)
===================================================================
--- z3ext.product/tags/1.2.1/CHANGES.txt (rev 0)
+++ z3ext.product/tags/1.2.1/CHANGES.txt 2008-09-29 20:20:19 UTC (rev 91628)
@@ -0,0 +1,84 @@
+=======
+CHANGES
+=======
+
+
+1.2.1 (2008-09-30)
+------------------
+
+- Fixed bug with enclosed sites.
+
+
+1.2.0 (2008-09-04)
+------------------
+
+- Added product dependencies (require attribute)
+
+
+1.1.2 (2008-08-13)
+------------------
+
+- Calculate installed status
+
+
+1.1.0 (2008-08-05)
+------------------
+
+- Implemented product management for enclosed site objects
+
+
+1.0.2 (2008-05-26)
+------------------
+
+- During product instalation, first install CA registry, then call update
+
+
+1.0.1 (2008-05-15)
+------------------
+
+- Compatibility with z3ext.controlpanel >= 1.2.3
+
+
+1.0.0 (2008-03-26)
+------------------
+
+- Tests added
+
+- Code moved to svn.zope.org
+
+
+0.11.1 (2008-03-04)
+-------------------
+
+- Added 'broken' base registry in case product not available.
+
+
+0.11 (2008-02-28)
+-----------------
+
+- Use z3c.baseregistry
+
+- Use z3c.autoinclude
+
+- Create components registry for each product.
+ now it's possible to use <registerIn registry="z3ext.product.productName'/>
+ for registering product adapters and utulities.
+
+
+0.10.2 (2008-02-18)
+------------------
+
+- Don't show 'Products Management' configlet
+ if there are no installable products
+
+
+0.10.1 (2008-02-01)
+------------------
+
+- Removed `grant` directives
+
+
+0.10 (2008-02-01)
+------------------
+
+- Initial release
Modified: z3ext.product/tags/1.2.1/setup.py
===================================================================
--- z3ext.product/trunk/setup.py 2008-09-25 13:28:26 UTC (rev 91481)
+++ z3ext.product/tags/1.2.1/setup.py 2008-09-29 20:20:19 UTC (rev 91628)
@@ -21,7 +21,7 @@
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
-version = '1.2.1dev'
+version = '1.2.1'
setup(name='z3ext.product',
Deleted: z3ext.product/tags/1.2.1/src/z3ext/product/README.txt
===================================================================
--- z3ext.product/trunk/src/z3ext/product/README.txt 2008-09-25 13:28:26 UTC (rev 91481)
+++ z3ext.product/tags/1.2.1/src/z3ext/product/README.txt 2008-09-29 20:20:19 UTC (rev 91628)
@@ -1,329 +0,0 @@
-=================
-Products (Add-on)
-=================
-
-Products system based on z3c.baseregistry package. This package
-simplify creating and managing registries.
-
-Loading zcml configuration
-
- >>> import z3ext.product
- >>> from zope.configuration import xmlconfig
- >>> context = xmlconfig.string("""
- ... <configure xmlns:z3ext="http://namespaces.zope.org/z3ext"
- ... xmlns="http://namespaces.zope.org/zope" i18n_domain="z3ext">
- ... <include package="z3ext.controlpanel" file="meta.zcml" />
- ... <include package="z3ext.product" file="meta.zcml" />
- ... <include package="zope.security" file="meta.zcml" />
- ... <include package="z3c.baseregistry" file="meta.zcml" />
- ...
- ... <permission
- ... id="z3ext.ManageProducts"
- ... title="Manage products" />
- ...
- ... <z3ext:configlet
- ... name="product"
- ... schema="z3ext.product.interfaces.IProductInstaller"
- ... title="Products management"
- ... description="This is the Add-on Products install section."
- ... class="z3ext.product.installer.ProductsInstaller"
- ... permission="z3ext.ManageProducts" />
- ...
- ... </configure>""")
-
- >>> from zope import component
- >>> from z3ext.controlpanel.interfaces import IConfiglet
-
- >>> installer = component.getUtility(IConfiglet, 'product')
- >>> installer.keys()
- ()
-
- >>> installer.isAvailable()
- False
-
- >>> from zope import schema, interface
-
- >>> class IMyProduct(interface.Interface):
- ... """ Basic product """
- ...
- ... email = schema.TextLine(
- ... title=u"E-mail Address",
- ... description=u"E-mail Address used to send notifications")
-
- >>> context = xmlconfig.string('''
- ... <configure
- ... xmlns:z3ext="http://namespaces.zope.org/z3ext" i18n_domain="test">
- ...
- ... <z3ext:product
- ... name="my-product"
- ... title="My product"
- ... configurable="true"
- ... schema="z3ext.product.README.IMyProduct" />
- ...
- ... </configure>''', context)
-
-After registration we can get product declaration by it's schema.
-
- >>> from z3ext.product.interfaces import IProduct
-
- >>> product = component.getUtility(IMyProduct)
- >>> product
- <z3ext.controlpanel.configlettype.Configlet<product.my-product> ...>
-
- >>> product.__title__
- u'My product'
-
- >>> IMyProduct.providedBy(product)
- True
-
-Or we can get product by it's name
-
- >>> component.getUtility(IProduct, 'my-product') is product
- True
-
-But product is also is configlet, configlet name is 'product.' prefix
-and product name
-
- >>> configlet = component.getUtility(IConfiglet, 'product.my-product')
- >>> configlet
- <z3ext.controlpanel.configlettype.Configlet<product.my-product> ...>
-
- >>> configlet is product
- True
-
-
-Product manipulation
---------------------
-
-Instalation status
-
- >>> product.isInstalled()
- False
-
-or
-
- >>> product.__installed__
- False
-
-Instalation
-
- >>> product.install()
- >>> product.__installed__
- True
-
- >>> product.install()
- Traceback (most recent call last):
- ...
- ProductAlreadyInstalledError: Product already installed.
-
-
-Updateing product
-
- >>> product.update()
-
-uninstall
-
- >>> product.uninstall()
- >>> product.__installed__
- False
-
-we can't uninstall or update not installed product
-
- >>> product.uninstall()
- Traceback (most recent call last):
- ...
- ProductNotInstalledError: Product is not installed.
-
- >>> product.update()
- Traceback (most recent call last):
- ...
- ProductNotInstalledError: Product is not installed.
-
-
-Product extension
------------------
-
-We can create product extension
-
- >>> class IMyProductExtension(interface.Interface):
- ... """Basic User Preferences"""
-
- >>> context = xmlconfig.string('''
- ... <configure
- ... xmlns:z3ext="http://namespaces.zope.org/z3ext" i18n_domain="test">
- ...
- ... <z3ext:product
- ... name="my-product.ext"
- ... title="Product extension"
- ... schema="z3ext.product.README.IMyProductExtension" />
- ...
- ... </configure>''', context)
-
- >>> ext = component.getUtility(IMyProductExtension)
- >>> ext
- <z3ext.controlpanel.configlettype.Configlet<product.my-product.ext> ...>
-
- >>> ext.__installed__
- False
-
- >>> ext.isInstalled()
- False
-
- >>> component.getUtility(IProduct, 'my-product.ext') is ext
- True
-
- >>> component.getUtility(IConfiglet, 'product.my-product.ext') is ext
- True
-
-We have to install product first, then we can install product extension
-
- >>> ext.install()
- Traceback (most recent call last):
- ...
- ProductNotInstalledError: my-product
-
- >>> ext.update()
- Traceback (most recent call last):
- ...
- ProductNotInstalledError: my-product
-
- >>> product.install()
- >>> ext.install()
-
- >>> ext = component.getUtility(IMyProductExtension)
- >>> ext.__installed__
- True
-
- >>> ext.isInstalled()
- True
-
- >>> ext.update()
-
- >>> ext.uninstall()
- >>> ext.__installed__
- False
-
-If we uninstall product, extension will uninstall also
-
- >>> ext.install()
- >>> product.uninstall()
- >>> ext.__installed__
- False
-
- >>> product.listExtensions()
- [u'ext']
-
-
-Product dependencies
---------------------
-Product can depends on other products.
-
- >>> class IMyProduct2(interface.Interface):
- ... """ Product 2 """
- ...
- ... email = schema.TextLine(
- ... title=u"E-mail Address",
- ... description=u"E-mail Address used to send notifications")
-
- >>> context = xmlconfig.string('''
- ... <configure
- ... xmlns:z3ext="http://namespaces.zope.org/z3ext" i18n_domain="test">
- ...
- ... <z3ext:product
- ... name="my-product2"
- ... title="My product2"
- ... require="my-product"
- ... schema="z3ext.product.README.IMyProduct2" />
- ...
- ... </configure>''', context)
-
-'my-product2' is depends on 'my-product'
-
- >>> product = component.getUtility(IMyProduct)
- >>> product.__installed__
- False
-
- >>> product2 = component.getUtility(IMyProduct2)
- >>> product2.__require__
- [u'my-product']
-
-Let's install my-product2
-
- >>> product2.install()
-
-Now both products are installed
-
- >>> product.__installed__
- True
-
- >>> product2.__installed__
- True
-
-But on uninstall required products stay intalled
-
- >>> product2.uninstall()
-
- >>> product.__installed__
- True
-
- >>> product.uninstall()
-
-
-Component registry
-------------------
-
-When we register product, system automaticly creates component registry
-
- >>> registry = z3ext.product.registries['my-product']
-
- >>> print registry
- Product: My product
-
- >>> repr(registry)
- '<Product: My product>'
-
- >>> component.interfaces.IComponents.providedBy(registry)
- True
-
-When we install product, product's component registry automaticly
-added to current site manager bases.
-
- >>> component.getSiteManager().__bases__
- (<BaseGlobalComponents base>,)
-
- >>> product.install()
-
- >>> component.getSiteManager().__bases__
- (<Product: My product>, <BaseGlobalComponents base>)
-
- >>> product.uninstall()
- >>> component.getSiteManager().__bases__
- (<BaseGlobalComponents base>,)
-
-With z3c.baseregistry it's possible to use <registerIn />
-directive. For example:
-
-<registerIn registry="z3ext.product.my-product>
- ... various declarations
-</registerIn>
-
-
-Product configlet
------------------
-
- >>> installer = component.getUtility(IConfiglet, 'product')
- >>> installer.keys()
- (u'my-product', u'my-product2')
-
- >>> installer.isAvailable()
- True
-
- >>> installer['my-product'] is product
- True
-
- >>> product.isAvailable()
- False
-
- >>> product.install()
- >>> product.isAvailable()
- True
Copied: z3ext.product/tags/1.2.1/src/z3ext/product/README.txt (from rev 91627, z3ext.product/trunk/src/z3ext/product/README.txt)
===================================================================
--- z3ext.product/tags/1.2.1/src/z3ext/product/README.txt (rev 0)
+++ z3ext.product/tags/1.2.1/src/z3ext/product/README.txt 2008-09-29 20:20:19 UTC (rev 91628)
@@ -0,0 +1,329 @@
+=================
+Products (Add-on)
+=================
+
+Products system based on z3c.baseregistry package. This package
+simplify creating and managing registries.
+
+Loading zcml configuration
+
+ >>> import z3ext.product
+ >>> from zope.configuration import xmlconfig
+ >>> context = xmlconfig.string("""
+ ... <configure xmlns:z3ext="http://namespaces.zope.org/z3ext"
+ ... xmlns="http://namespaces.zope.org/zope" i18n_domain="z3ext">
+ ... <include package="z3ext.controlpanel" file="meta.zcml" />
+ ... <include package="z3ext.product" file="meta.zcml" />
+ ... <include package="zope.security" file="meta.zcml" />
+ ... <include package="z3c.baseregistry" file="meta.zcml" />
+ ...
+ ... <permission
+ ... id="z3ext.ManageProducts"
+ ... title="Manage products" />
+ ...
+ ... <z3ext:configlet
+ ... name="product"
+ ... schema="z3ext.product.interfaces.IProductInstaller"
+ ... title="Products management"
+ ... description="This is the Add-on Products install section."
+ ... class="z3ext.product.installer.ProductsInstaller"
+ ... permission="z3ext.ManageProducts" />
+ ...
+ ... </configure>""")
+
+ >>> from zope import component, interface
+ >>> from z3ext.controlpanel.interfaces import IConfiglet
+
+ >>> installer = component.getUtility(IConfiglet, 'product')
+ >>> installer.keys()
+ ()
+
+ >>> installer.isAvailable()
+ False
+
+ >>> from zope import schema, interface
+
+ >>> class IMyProduct(interface.Interface):
+ ... """ Basic product """
+ ...
+ ... email = schema.TextLine(
+ ... title=u"E-mail Address",
+ ... description=u"E-mail Address used to send notifications")
+
+ >>> context = xmlconfig.string('''
+ ... <configure
+ ... xmlns:z3ext="http://namespaces.zope.org/z3ext" i18n_domain="test">
+ ...
+ ... <z3ext:product
+ ... name="my-product"
+ ... title="My product"
+ ... configurable="true"
+ ... schema="z3ext.product.README.IMyProduct" />
+ ...
+ ... </configure>''', context)
+
+After registration we can get product declaration by it's schema.
+
+ >>> from z3ext.product.interfaces import IProduct
+
+ >>> product = component.getUtility(IMyProduct)
+ >>> product
+ <z3ext.controlpanel.configlettype.Configlet<product.my-product> ...>
+
+ >>> product.__title__
+ u'My product'
+
+ >>> IMyProduct.providedBy(product)
+ True
+
+Or we can get product by it's name
+
+ >>> component.getUtility(IProduct, 'my-product') is product
+ True
+
+But product is also is configlet, configlet name is 'product.' prefix
+and product name
+
+ >>> configlet = component.getUtility(IConfiglet, 'product.my-product')
+ >>> configlet
+ <z3ext.controlpanel.configlettype.Configlet<product.my-product> ...>
+
+ >>> configlet is product
+ True
+
+
+Product manipulation
+--------------------
+
+Instalation status
+
+ >>> product.isInstalled()
+ False
+
+or
+
+ >>> product.__installed__
+ False
+
+Instalation
+
+ >>> product.install()
+ >>> product.__installed__
+ True
+
+ >>> product.install()
+ Traceback (most recent call last):
+ ...
+ ProductAlreadyInstalledError: Product already installed.
+
+
+Updateing product
+
+ >>> product.update()
+
+uninstall
+
+ >>> product.uninstall()
+ >>> product.__installed__
+ False
+
+we can't uninstall or update not installed product
+
+ >>> product.uninstall()
+ Traceback (most recent call last):
+ ...
+ ProductNotInstalledError: Product is not installed.
+
+ >>> product.update()
+ Traceback (most recent call last):
+ ...
+ ProductNotInstalledError: Product is not installed.
+
+
+Product extension
+-----------------
+
+We can create product extension
+
+ >>> class IMyProductExtension(interface.Interface):
+ ... """Basic User Preferences"""
+
+ >>> context = xmlconfig.string('''
+ ... <configure
+ ... xmlns:z3ext="http://namespaces.zope.org/z3ext" i18n_domain="test">
+ ...
+ ... <z3ext:product
+ ... name="my-product.ext"
+ ... title="Product extension"
+ ... schema="z3ext.product.README.IMyProductExtension" />
+ ...
+ ... </configure>''', context)
+
+ >>> ext = component.getUtility(IMyProductExtension)
+ >>> ext
+ <z3ext.controlpanel.configlettype.Configlet<product.my-product.ext> ...>
+
+ >>> ext.__installed__
+ False
+
+ >>> ext.isInstalled()
+ False
+
+ >>> component.getUtility(IProduct, 'my-product.ext') is ext
+ True
+
+ >>> component.getUtility(IConfiglet, 'product.my-product.ext') is ext
+ True
+
+We have to install product first, then we can install product extension
+
+ >>> ext.install()
+ Traceback (most recent call last):
+ ...
+ ProductNotInstalledError: my-product
+
+ >>> ext.update()
+ Traceback (most recent call last):
+ ...
+ ProductNotInstalledError: my-product
+
+ >>> product.install()
+ >>> ext.install()
+
+ >>> ext = component.getUtility(IMyProductExtension)
+ >>> ext.__installed__
+ True
+
+ >>> ext.isInstalled()
+ True
+
+ >>> ext.update()
+
+ >>> ext.uninstall()
+ >>> ext.__installed__
+ False
+
+If we uninstall product, extension will uninstall also
+
+ >>> ext.install()
+ >>> product.uninstall()
+ >>> ext.__installed__
+ False
+
+ >>> product.listExtensions()
+ [u'ext']
+
+
+Product dependencies
+--------------------
+Product can depends on other products.
+
+ >>> class IMyProduct2(interface.Interface):
+ ... """ Product 2 """
+ ...
+ ... email = schema.TextLine(
+ ... title=u"E-mail Address",
+ ... description=u"E-mail Address used to send notifications")
+
+ >>> context = xmlconfig.string('''
+ ... <configure
+ ... xmlns:z3ext="http://namespaces.zope.org/z3ext" i18n_domain="test">
+ ...
+ ... <z3ext:product
+ ... name="my-product2"
+ ... title="My product2"
+ ... require="my-product"
+ ... schema="z3ext.product.README.IMyProduct2" />
+ ...
+ ... </configure>''', context)
+
+'my-product2' is depends on 'my-product'
+
+ >>> product = component.getUtility(IMyProduct)
+ >>> product.__installed__
+ False
+
+ >>> product2 = component.getUtility(IMyProduct2)
+ >>> product2.__require__
+ [u'my-product']
+
+Let's install my-product2
+
+ >>> product2.install()
+
+Now both products are installed
+
+ >>> product.__installed__
+ True
+
+ >>> product2.__installed__
+ True
+
+But on uninstall required products stay intalled
+
+ >>> product2.uninstall()
+
+ >>> product.__installed__
+ True
+
+ >>> product.uninstall()
+
+
+Component registry
+------------------
+
+When we register product, system automaticly creates component registry
+
+ >>> registry = z3ext.product.registries['my-product']
+
+ >>> print registry
+ Product: My product
+
+ >>> repr(registry)
+ '<Product: My product>'
+
+ >>> component.interfaces.IComponents.providedBy(registry)
+ True
+
+When we install product, product's component registry automaticly
+added to current site manager bases.
+
+ >>> component.getSiteManager().__bases__
+ (<BaseGlobalComponents base>,)
+
+ >>> product.install()
+
+ >>> component.getSiteManager().__bases__
+ (<Product: My product>, <BaseGlobalComponents base>)
+
+ >>> product.uninstall()
+ >>> component.getSiteManager().__bases__
+ (<BaseGlobalComponents base>,)
+
+With z3c.baseregistry it's possible to use <registerIn />
+directive. For example:
+
+<registerIn registry="z3ext.product.my-product>
+ ... various declarations
+</registerIn>
+
+
+Product configlet
+-----------------
+
+ >>> installer = component.getUtility(IConfiglet, 'product')
+ >>> installer.keys()
+ (u'my-product', u'my-product2')
+
+ >>> installer.isAvailable()
+ True
+
+ >>> installer['my-product'] is product
+ True
+
+ >>> product.isAvailable()
+ False
+
+ >>> product.install()
+ >>> product.isAvailable()
+ True
Copied: z3ext.product/tags/1.2.1/src/z3ext/product/enclosed.txt (from rev 91627, z3ext.product/trunk/src/z3ext/product/enclosed.txt)
===================================================================
--- z3ext.product/tags/1.2.1/src/z3ext/product/enclosed.txt (rev 0)
+++ z3ext.product/tags/1.2.1/src/z3ext/product/enclosed.txt 2008-09-29 20:20:19 UTC (rev 91628)
@@ -0,0 +1,127 @@
+===========================
+Products for enclosed sites
+===========================
+
+Loading zcml configuration
+
+ >>> import z3ext.product
+ >>> from zope.configuration import xmlconfig
+ >>> context = xmlconfig.string("""
+ ... <configure xmlns:z3ext="http://namespaces.zope.org/z3ext"
+ ... xmlns="http://namespaces.zope.org/zope" i18n_domain="z3ext">
+ ... <include package="z3ext.controlpanel" file="meta.zcml" />
+ ... <include package="z3ext.product" file="meta.zcml" />
+ ... <include package="zope.security" file="meta.zcml" />
+ ... <include package="z3c.baseregistry" file="meta.zcml" />
+ ...
+ ... <permission
+ ... id="z3ext.ManageProducts"
+ ... title="Manage products" />
+ ...
+ ... <z3ext:configlet
+ ... name="product"
+ ... schema="z3ext.product.interfaces.IProductInstaller"
+ ... title="Products management"
+ ... description="This is the Add-on Products install section."
+ ... class="z3ext.product.installer.ProductsInstaller"
+ ... permission="z3ext.ManageProducts" />
+ ...
+ ... </configure>""")
+
+
+Product
+
+ >>> from zope import schema, component, interface
+
+ >>> class IMyProduct(interface.Interface):
+ ... """ Basic product """
+
+ >>> context = xmlconfig.string('''
+ ... <configure
+ ... xmlns:z3ext="http://namespaces.zope.org/z3ext" i18n_domain="test">
+ ...
+ ... <z3ext:product
+ ... name="my-product"
+ ... title="My product"
+ ... configurable="true"
+ ... schema="z3ext.product.README.IMyProduct" />
+ ...
+ ... </configure>''', context)
+
+ >>> from z3ext import product
+ >>> from z3ext.product.interfaces import IProduct
+
+ >>> productRegistry = z3ext.product.registries['my-product']
+
+ >>> class IMyUtility(interface.Interface):
+ ... """ """
+
+ >>> class MyUtility(object):
+ ... interface.implements(IMyUtility)
+
+ >>> utility = MyUtility()
+ >>> productRegistry.registerUtility(utility, name='myUtility')
+
+ >>> from zope.app.folder.folder import Folder
+ >>> from zope.app.component.site import LocalSiteManager
+ >>> from zope.app.component.hooks import getSite, setSite
+
+ >>> site = getSite()
+ >>> site1 = Folder()
+ >>> site['site1'] = site1
+ >>> sm = LocalSiteManager(site1)
+ >>> site1.setSiteManager(sm)
+
+ >>> site.getSiteManager().queryUtility(IMyUtility, name='myUtility') is None
+ True
+
+ >>> site1.getSiteManager().queryUtility(IMyUtility, name='myUtility') is None
+ True
+
+Install product
+
+ >>> product = component.getUtility(IMyProduct)
+ >>> product.isInstalled()
+ False
+ >>> product.install()
+
+ >>> site.getSiteManager().queryUtility(IMyUtility, name='myUtility')
+ <z3ext.product.README.MyUtility object at ...>
+
+ >>> site1.getSiteManager().queryUtility(IMyUtility, name='myUtility')
+ <z3ext.product.README.MyUtility object at ...>
+
+ >>> product.isInstalled()
+ True
+ >>> product.isUninstallable()
+ True
+
+Installation status in subsite
+
+ >>> setSite(site1)
+ >>> product = component.getUtility(IMyProduct)
+ >>> product.isInstalled()
+ True
+ >>> product.isUninstallable()
+ False
+
+ >>> setSite(site)
+ >>> product = component.getUtility(IMyProduct)
+ >>> product.uninstall()
+
+ >>> setSite(site1)
+ >>> product = component.getUtility(IMyProduct)
+ >>> product.isInstalled()
+ False
+ >>> product.install()
+
+ >>> site1.getSiteManager().queryUtility(IMyUtility, name='myUtility')
+ <z3ext.product.README.MyUtility object at ...>
+
+ >>> setSite(site)
+ >>> product = component.getUtility(IMyProduct)
+ >>> product.isInstalled()
+ False
+
+ >>> site.getSiteManager().queryUtility(IMyUtility, name='myUtility') is None
+ True
Deleted: z3ext.product/tags/1.2.1/src/z3ext/product/product.py
===================================================================
--- z3ext.product/trunk/src/z3ext/product/product.py 2008-09-25 13:28:26 UTC (rev 91481)
+++ z3ext.product/tags/1.2.1/src/z3ext/product/product.py 2008-09-29 20:20:19 UTC (rev 91628)
@@ -1,163 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2007 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""
-
-$Id: product.py 1843 2008-03-25 18:39:00Z fafhrd91 $
-"""
-from BTrees.OOBTree import OOBTree
-
-from zope import interface, event
-from zope.component import getSiteManager
-from zope.component import getUtility, queryUtility, getUtilitiesFor
-
-from z3c.configurator import configure
-
-import z3ext.product
-from z3ext.controlpanel.configlettype import ConfigletProperty
-
-from z3ext.product import interfaces
-from z3ext.product.interfaces import _, IProduct, IProductExtension
-
-
-class Product(object):
- """ base product class """
- interface.implements(IProduct)
-
- @property
- def __installed__(self):
- sm = getSiteManager()
-
- registry = getattr(z3ext.product, self.__product_name__)
- return registry in sm.__bases__
-
- def _checkRequiredInstall(self):
- for productId in self.__require__:
- product = queryUtility(IProduct, productId)
- if product is None:
- raise interfaces.RequiredProductNotFound(
- _('Required product is not found.'))
- if not product.__installed__:
- product.install()
-
- def _checkRequiredUpdate(self):
- for productId in self.__require__:
- product = queryUtility(IProduct, productId)
- if product is None:
- raise interfaces.RequiredProductNotFound(
- _('Required product is not found.'))
- if not product.__installed__:
- product.install()
- else:
- product.update()
-
- def install(self):
- self._checkRequiredInstall()
-
- if self.__installed__:
- raise interfaces.ProductAlreadyInstalledError(
- _('Product already installed.'))
-
- sm = getSiteManager()
-
- registry = getattr(z3ext.product, self.__product_name__)
- sm.__bases__ = (registry,) + sm.__bases__
-
- event.notify(interfaces.ProductInstalledEvent(self.__product_name__, self))
-
- self.update()
-
- def update(self):
- if not self.__installed__:
- raise interfaces.ProductNotInstalledError(
- _('Product is not installed.'))
-
- configure(self, {})
- event.notify(
- interfaces.ProductUpdatedEvent(self.__product_name__, self))
-
- self._checkRequiredUpdate()
-
- def uninstall(self):
- for name, ext in self.items():
- if IProductExtension.providedBy(ext) and ext.__installed__:
- ext.uninstall()
-
- if not self.__installed__:
- raise interfaces.ProductNotInstalledError(
- _('Product is not installed.'))
-
- sm = getSiteManager()
- registry = getattr(z3ext.product, self.__product_name__)
-
- bases = list(sm.__bases__)
- bases.remove(registry)
- sm.__bases__ = tuple(bases)
-
- event.notify(
- interfaces.ProductUninstalledEvent(self.__product_name__, self))
-
- def _checkInstalled(self, sm, registry, seen):
- if sm in seen:
- return False
- seen.add(sm)
-
- if registry in sm.__bases__:
- return True
-
- for reg in sm.__bases__:
- if self._checkInstalled(reg, registry, seen):
- return True
-
- return False
-
- def isInstalled(self):
- sm = getSiteManager()
- registry = getattr(z3ext.product, self.__product_name__)
- seen = set()
- return self._checkInstalled(sm, registry, seen)
-
- def listExtensions(self):
- exts = []
- for name, ext in self.items():
- if IProductExtension.providedBy(ext):
- exts.append(name)
-
- return exts
-
- def isUninstallable(self):
- sm = getSiteManager()
- registry = getattr(z3ext.product, self.__product_name__)
- return registry in sm.__bases__
-
-
-class ProductExtension(Product):
- interface.implements(IProductExtension)
-
- def install(self):
- if not self.__parent__.__installed__:
- raise interfaces.ProductNotInstalledError(
- self.__parent__.__product_name__)
- super(ProductExtension, self).install()
-
- def update(self):
- if not self.__parent__.__installed__:
- raise interfaces.ProductNotInstalledError(
- self.__parent__.__product_name__)
- super(ProductExtension, self).update()
-
- def isInstalled(self):
- if self.__parent__.__installed__:
- return self.__installed__
- else:
- return False
Copied: z3ext.product/tags/1.2.1/src/z3ext/product/product.py (from rev 91627, z3ext.product/trunk/src/z3ext/product/product.py)
===================================================================
--- z3ext.product/tags/1.2.1/src/z3ext/product/product.py (rev 0)
+++ z3ext.product/tags/1.2.1/src/z3ext/product/product.py 2008-09-29 20:20:19 UTC (rev 91628)
@@ -0,0 +1,172 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+
+$Id: product.py 1843 2008-03-25 18:39:00Z fafhrd91 $
+"""
+from BTrees.OOBTree import OOBTree
+
+from zope import interface, event
+from zope.component import getSiteManager
+from zope.component import getUtility, queryUtility, getUtilitiesFor
+from zope.app.component.interfaces import ILocalSiteManager
+
+from z3c.configurator import configure
+
+import z3ext.product
+from z3ext.controlpanel.configlettype import ConfigletProperty
+
+from z3ext.product import interfaces
+from z3ext.product.interfaces import _, IProduct, IProductExtension
+
+
+class Product(object):
+ """ base product class """
+ interface.implements(IProduct)
+
+ @property
+ def __installed__(self):
+ sm = getSiteManager()
+
+ registry = getattr(z3ext.product, self.__product_name__)
+ return registry in sm.__bases__
+
+ def _checkRequiredInstall(self):
+ for productId in self.__require__:
+ product = queryUtility(IProduct, productId)
+ if product is None:
+ raise interfaces.RequiredProductNotFound(
+ _('Required product is not found.'))
+ if not product.__installed__:
+ product.install()
+
+ def _checkRequiredUpdate(self):
+ for productId in self.__require__:
+ product = queryUtility(IProduct, productId)
+ if product is None:
+ raise interfaces.RequiredProductNotFound(
+ _('Required product is not found.'))
+ if not product.__installed__:
+ product.install()
+ else:
+ product.update()
+
+ def install(self):
+ self._checkRequiredInstall()
+
+ if self.__installed__:
+ raise interfaces.ProductAlreadyInstalledError(
+ _('Product already installed.'))
+
+ sm = getSiteManager()
+
+ registry = getattr(z3ext.product, self.__product_name__)
+ sm.__bases__ = (registry,) + sm.__bases__
+
+ if ILocalSiteManager.providedBy(sm):
+ for subsm in sm.subs:
+ subsm.__bases__ = subsm.__bases__
+
+ event.notify(interfaces.ProductInstalledEvent(self.__product_name__, self))
+
+ self.update()
+
+ def update(self):
+ if not self.__installed__:
+ raise interfaces.ProductNotInstalledError(
+ _('Product is not installed.'))
+
+ configure(self, {})
+ event.notify(
+ interfaces.ProductUpdatedEvent(self.__product_name__, self))
+
+ self._checkRequiredUpdate()
+
+ def uninstall(self):
+ for name, ext in self.items():
+ if IProductExtension.providedBy(ext) and ext.__installed__:
+ ext.uninstall()
+
+ if not self.__installed__:
+ raise interfaces.ProductNotInstalledError(
+ _('Product is not installed.'))
+
+ sm = getSiteManager()
+ registry = getattr(z3ext.product, self.__product_name__)
+
+ bases = list(sm.__bases__)
+ bases.remove(registry)
+ sm.__bases__ = tuple(bases)
+
+ if ILocalSiteManager.providedBy(sm):
+ for subsm in sm.subs:
+ subsm.__bases__ = subsm.__bases__
+
+ event.notify(
+ interfaces.ProductUninstalledEvent(self.__product_name__, self))
+
+ def _checkInstalled(self, sm, registry, seen):
+ if sm in seen:
+ return False
+ seen.add(sm)
+
+ if registry in sm.__bases__:
+ return True
+
+ for reg in sm.__bases__:
+ if self._checkInstalled(reg, registry, seen):
+ return True
+
+ return False
+
+ def isInstalled(self):
+ sm = getSiteManager()
+ registry = getattr(z3ext.product, self.__product_name__)
+ seen = set()
+ return self._checkInstalled(sm, registry, seen)
+
+ def listExtensions(self):
+ exts = []
+ for name, ext in self.items():
+ if IProductExtension.providedBy(ext):
+ exts.append(name)
+
+ return exts
+
+ def isUninstallable(self):
+ sm = getSiteManager()
+ registry = getattr(z3ext.product, self.__product_name__)
+ return registry in sm.__bases__
+
+
+class ProductExtension(Product):
+ interface.implements(IProductExtension)
+
+ def install(self):
+ if not self.__parent__.__installed__:
+ raise interfaces.ProductNotInstalledError(
+ self.__parent__.__product_name__)
+ super(ProductExtension, self).install()
+
+ def update(self):
+ if not self.__parent__.__installed__:
+ raise interfaces.ProductNotInstalledError(
+ self.__parent__.__product_name__)
+ super(ProductExtension, self).update()
+
+ def isInstalled(self):
+ if self.__parent__.__installed__:
+ return self.__installed__
+ else:
+ return False
Deleted: z3ext.product/tags/1.2.1/src/z3ext/product/tests.py
===================================================================
--- z3ext.product/trunk/src/z3ext/product/tests.py 2008-09-25 13:28:26 UTC (rev 91481)
+++ z3ext.product/tags/1.2.1/src/z3ext/product/tests.py 2008-09-29 20:20:19 UTC (rev 91628)
@@ -1,38 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2007 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""
-
-$Id: tests.py 84833 2008-03-21 09:09:54Z fafhrd $
-"""
-import unittest, doctest
-from zope.component import testing
-from zope.app.testing import setup
-from z3ext.controlpanel.testing import setUpControlPanel
-
-def setUp(test):
- setup.placefulSetUp(True)
- setup.setUpTestAsModule(test, 'z3ext.product.README')
- setUpControlPanel()
-
-def tearDown(test):
- setup.placefulTearDown()
- setup.tearDownTestAsModule(test)
-
-def test_suite():
- return unittest.TestSuite((
- doctest.DocFileSuite(
- 'README.txt',
- setUp=setUp, tearDown=tearDown,
- optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
- ))
Copied: z3ext.product/tags/1.2.1/src/z3ext/product/tests.py (from rev 91627, z3ext.product/trunk/src/z3ext/product/tests.py)
===================================================================
--- z3ext.product/tags/1.2.1/src/z3ext/product/tests.py (rev 0)
+++ z3ext.product/tags/1.2.1/src/z3ext/product/tests.py 2008-09-29 20:20:19 UTC (rev 91628)
@@ -0,0 +1,42 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+
+$Id: tests.py 84833 2008-03-21 09:09:54Z fafhrd $
+"""
+import unittest, doctest
+from zope.component import testing
+from zope.app.testing import setup
+from z3ext.controlpanel.testing import setUpControlPanel
+
+def setUp(test):
+ setup.placefulSetUp(True)
+ setup.setUpTestAsModule(test, 'z3ext.product.README')
+ setUpControlPanel()
+
+def tearDown(test):
+ setup.placefulTearDown()
+ setup.tearDownTestAsModule(test)
+
+def test_suite():
+ return unittest.TestSuite((
+ doctest.DocFileSuite(
+ 'README.txt',
+ setUp=setUp, tearDown=tearDown,
+ optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
+ doctest.DocFileSuite(
+ 'enclosed.txt',
+ setUp=setUp, tearDown=tearDown,
+ optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
+ ))
More information about the Checkins
mailing list