Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install z3ext.product

How to install z3ext.product

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install z3ext.product
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
1.4.0 Available View build log
Windows (64-bit)
1.4.0 Available View build log
Mac OS X (10.5+)
1.4.0 Available View build log
Linux (32-bit)
1.4.0 Available View build log
Linux (64-bit)
1.4.0 Available View build log
Web
 
Author
License
ZPL 2.1
Imports
Lastest release
version 1.4.0 on Jan 5th, 2011

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 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

CHANGES

1.4.0 (2009-08-11)
  • Do not use z3c.autoinclude
  • Copyright holder changed
1.3.1 (2009-02-03)
  • Send ObjectModifiedEvent for site on product install/uninstall.
1.3.0 (2008-11-21)
  • Install product registry after base registries
  • Removed product extension system
1.2.2 (2008-10-28)
  • Added translations: nl, ru
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.

System Message: WARNING/2 (<string>, line 352)

Bullet list ends without a blank line; unexpected unindent.

now it's possible to use <registerIn registry="z3ext.product.productName'/> for registering product adapters and utulities.

0.10.2 (2008-02-18)

System Message: WARNING/2 (<string>, line 357)

Title underline too short.

0.10.2 (2008-02-18)
------------------
  • Don't show 'Products Management' configlet

System Message: WARNING/2 (<string>, line 360)

Bullet list ends without a blank line; unexpected unindent.

if there are no installable products

0.10.1 (2008-02-01)

System Message: WARNING/2 (<string>, line 364)

Title underline too short.

0.10.1 (2008-02-01)
------------------
  • Removed grant directives
0.10 (2008-02-01)
  • Initial release

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:4

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.