What is modification,
and why do we care? (was Re: [Zope3-dev] Missing
ObjectContentModifiedEvent)
Dylan Reinhardt
dylanreinhardt at gmail.com
Thu Jun 2 12:48:16 EDT 2005
On 5/26/05, Jim Fulton <jim at zope.com> wrote:
> Given the applications above, I don't think that there's value in
> fine-grained modification events that justifies the complecity of
> proposals we've thought of so far.
>
>
> Thoughts?
I doubt the event system needs to be much more fine-grained. If you
want an event to tell you when a particular property value has
changed, it's easy enough to use a custom field that wraps set() and
spawns a custom change event, e.g:
# untested...
class SearchableTextLineModified(ObjectEvent):
def __init__(self, object, changed_field):
ObjectEvent.__init__(self, object)
self.changed_field = changed_field
class SearchableTextLine(TextLine):
def set(self, object, value):
TextLine.set(self, object, value)
notify(SearchableTextLineModified(object, self.__name__))
If you use this field type for all text properties you want searched,
your text index can simply ignore all change events beside the one(s)
you care about and *then* only act on the specific fields changed.
Other tools that depend on built-in change events should still work.
This approach has the advantage of providing events that are as
fine-grained as the developer wishes them to be and pushes
resposibility for managing any resulting complexity sqarely on the
developer's shoulders. I doubt that making Zope's built-in events
more complicated is the way to go.
FWIW, $.02, etc,
Dylan
>
> Are there other applications for modification events that
> I haven't considered?
>
> Jim
>
> --
> Jim Fulton mailto:jim at zope.com Python Powered!
> CTO (540) 361-1714 http://www.python.org
> Zope Corporation http://www.zope.com http://www.zope.org
> _______________________________________________
> Zope3-dev mailing list
> Zope3-dev at zope.org
> Unsub: http://mail.zope.org/mailman/options/zope3-dev/dylanreinhardt%40gmail.com
>
>
More information about the Zope3-dev
mailing list