Maken Seteva wrote:
Hi!
I am a bit curious about the behavior of the tagcount when tagging with lovely.tag. Here is a snip from my doctest:


Nothing initially
    >>> sorted(e.getCloud(users=[u'barney']))
    []

Update tags for barney
    >>> e.update(1000, u'barney', [u'foo'])
    >>> e.update(1000, u'barney', [u'foo', u'bar'])

Print them
    >>> sorted(e.getCloud(items=(1000,), users=(u'barney',)))
    [(u'bar', 1), (u'foo', 2)]

Update and print again:
    >>> e.update(1000, u'barney', [u'eggs'])
    >>> sorted(e.getCloud(items=(1000,), users=(u'barney',)))
    [(u'eggs', 1)]

This is exactly the expected behaviour it is described in the engine interface :

class ITaggingEngine(zope.interface.Interface):
    """Manangement and Querying of Tags.

    Tags are small stickers that are specific to an object to be tagged
    and the user tagging the object.
    """

    def update(item, user, tags):
        """Update the tagging engine for an item and user and its tags.

        The item must be an integer, the user can be a string and the
        tags argument must be an iterable of tag names (strings).

        This method always overwrites the old tag settings. However,
        existing tags will not be readded and are just skipped.
        """



My first thing i notice is that there is no concept of 'updating' a users tags on an object in the sense that first you add a tag then later you add another tag with the old one being untouched (the tag count for the old one not being incremented every time i update!). Is there a special reason for this philosophy?

The way this function works is very convenience, because usually you have a user editing his tags. The you just take the edited list of tags and use update to update the tagging engine.


Regards
Jürgen

_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to