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.

pypm install cykooz.title

How to install cykooz.title

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install cykooz.title
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
1.0.0 Available View build log
Windows (64-bit)
1.0.0 Available View build log
Mac OS X (10.5+)
1.0.0 Available View build log
Linux (32-bit)
1.0.0 Available View build log
Linux (64-bit)
1.0.0 Available View build log
Lastest release
version 1.0.0 on Mar 15th, 2011

This package implements adapters for adapting any object to ITitle interface.

Let's do some imports we will use later.

>>> import zope.interface
>>> import zope.component
>>> from zope.annotation.interfaces import IAttributeAnnotatable
>>> from zope.dublincore.interfaces import IZopeDublinCore
>>> from zope.container.interfaces import IContained
>>> from cykooz.title.interfaces import ITitle
>>> from cykooz.title import adapters

Let's register the adapters, this is normally done in configure.zcml:

>>> zope.component.provideAdapter(adapters.ClassName2TitleAdapter)
>>> zope.component.provideAdapter(adapters.Contained2TitleAdapter)
>>> zope.component.provideAdapter(adapters.ZDC2TitleAdapter)

Implement test object:

>>> class SomeClass(object):
...     zope.interface.implements(zope.interface.Interface)
>>> some_object = SomeClass()

Get title from class name:

>>> ITitle(some_object).title

Now change the test object so that it provide IContained:

>>> zope.interface.directlyProvides(some_object, IContained)
>>> some_object.__name__ = u'NameInContainer'
>>> ITitle(some_object).title

Change the test object so that is provide only IAttributeAnnotatable:

>>> zope.interface.directlyProvides(some_object, IAttributeAnnotatable)
>>> IZopeDublinCore(some_object).title

If object do not provide IContained and field 'title' of IZopeDublinCore is empty then ITitle adapter return class name of object:

>>> ITitle(some_object).title

Now change the test object so that it also provide IContained:

>>> zope.interface.alsoProvides(some_object, IContained)
>>> ITitle(some_object).title

Set field 'title' of IZopeDublinCore:

>>> IZopeDublinCore(some_object).title = u'ZopeDublinCore Title'
>>> IZopeDublinCore(some_object).title
u'ZopeDublinCore Title'

Test adapter:

>>> ITitle(some_object).title
u'ZopeDublinCore Title'


1.0.0 (2011-03-14)
  • Initial release

Subscribe to package updates

Last updated Mar 15th, 2011

Download Stats

Last month:1

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.