You are here: Home Zope products lovely.tag

lovely.tag (1.1.1)

by Olha Pelishok last modified 2009-11-19
Released on 2009-11-18 by Lovely Systems under Zope Public License (ZPL) available for All platforms.
Software development stage: stable
A tagging engine for Zope 3


A tagging engine allows you to assign tags to any type of object by an user. A tag is a simple string.

>>> from lovely import tag

Tagging Engine

The tagging engine provides the capabilities to manipulate and and query tagged items.

>>> engine = tag.TaggingEngine()
>>> engine
<TaggingEngine entries=0>

The first step is to associate tags with an item for a user. Items are referenced by their intId, the user is a system-wide unique string and the tags is a simple list of strings.

Before updating the engine we need to ensure that persistent objects can be adapted to key references:

>>> import zope.component
>>> from import testing
>>> zope.component.provideAdapter(testing.SimpleKeyReference)

Instead providing a separate API for adding and updating tags, both actions are done via the update() method. Think of it as updating the tagging engine.

>>> engine.update(1, u'srichter', [u'USA', u'personal'])
>>> engine.update(2, u'srichter', [u'austria', u'lovely'])
>>> engine.update(3, u'jodok', [u'Austria', u'personal'])
>>> engine.update(2, u'jodok', [u'austria', u'lovely', u'work'])

Next you can ask the engine several questions.

Document Actions
Powered by Plone