This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

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

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
cykooz.title-1.0.0.tar.gz (4.8 kB) Copy SHA256 Checksum SHA256 Source Mar 14, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting