[Zope3-dev] Persistence?

Steve Alexander steve@cat-box.net
Sun, 08 Jun 2003 18:13:36 +0300


Marcus J. Ertl wrote:
> Hi again!
> 
> At trying to solve my problems with event registration, I had digged a
> bit through the code of Zope3. What I found was in
> zope/app/event/subs.py (starting at line 104)::
> 
>   subscribers = clean_self._registry.get(ev_type)
>   if subscribers is None:
>       subscribers = []
>       clean_self._registry.register(ev_type, subscribers)
>   subscribers.append((token, filter))
> 
> And in zope/interface/type.py (starting at line 48)::
> 
>   def register(self, interface, object):
>       if interface is None or IInterface.isImplementedBy(interface):
>           self._reg[interface] = object
>       else:
>           raise TypeError(
>               "The interface argument must be an interface (or None)")
> 
> (I hope linebreak will leave it readable.)
> 
> I'm not sure, if subscribe.append(...) starts the persistence maschinery
> of zope. I'm afraid it doesn't. This would explain my problem on
> registering events. I don't know how to change it, if this is realy the
> reason for some of the problems mentioned allready in an earlier mail.

You might have found a bug!

Try adding the statement

   self._p_changed = 1

just before the line

   subscribers.append((token, filter))

And see if that fixes the problems you're seeing.

--
Steve Alexander