Opening up a new thread since the old one is using some old ideas,
but still thanks to Douglas for replying :)
What I'm really trying to do is probably analogous to the buzzword
"tagging". In other words a component can have
a list of keywords that describe it. I saw Jeff's sketchy solution in
another thread but he basically used dublincore..
I want to implement it with my own annotations. Here's my idea:
"""Marker interface for components that can be tagged"""
tags = List(Word())
KEY = "foo.bar"
def __init__(self, context):
self.context = self.__parent__ = context
tags = IAnnotations(context).get(KEY)
if tags is None:
tags = annotations[KEY] = PersistentList()
self.tags = tags
Any class that wants to be taggable needs to have ITaggable in its
<implements interface="..."/>. And then i simply
add Fields(ITagging) to the form_fields of the Add and Edit form.
This doesn't work, tags doesn't get written
and I think something is missing in the Tagging implementation
because how would the add/edit-forms know how
to write to the tags attribute?
btw, here's my implementation of the Word schema field i wrote:
"""A word cannot contain spaces"""
def constraint(self, value):
return super(Word, self).constraint(value) and ' ' not in
Zope3-users mailing list