On Tue, Feb 20, 2007 at 07:53:14PM +0100, Philipp von Weitershausen wrote:
> Alek Kowalczyk wrote:
> >I have subscribed to the ObjectAddedEvent for my OrderedContainer.
> >There is the a strange behavior in the event handler:
> >- myObj is my contained object
> >- myObj.__parent__ is my OrderedContainer.
> >
> >1. this returns True when called in the event handler:
> >myObj.__name__ in myObj.__parent__
> >2. this returns False when called in the event handler:
> >myObj.__name__ in myObj.__parent__.keys()
> >
> >Code inspection of OrderedContainer.__setitem__ shows the following:
> >1. first call setitem, which triggers event as side effect
> >setitem(self, self._data.__setitem__, key, object)
> >
> >2. after that add key to the _order, which is returned by keys() method:
> >if not existed:
> >   self._order.append(key)
> >
> >Is it bug or just works-as-designed? 
> >I think that this behavior is improper or at least confusing a bit. 
> >Event should be called *after* 
> >the keys() method is able to return list with added object, so that:
> >(myObj.__name__ in myObj.__parent__) == 
> >(myObj.__name__ in myObj.__parent__.keys())
> Yes. I think
>         if not existed:
>             self._order.append(key)
> should be executed before
>         setitem(self, self._data.__setitem__, key, object)

setitem() may raise various exceptions (e.g. DuplicationError).  It
would be good to not have extra names left in _order in that case.

> Perhaps you can round up a patch, including a test that tests this from 
> an event handler perspective? You can submit the patch and the original 
> bug report to the Zope 3 bug collector 
> (http://www.zope.org/Collectors/Zope3-dev).

Marius Gedminas
<Corsac> yeah, i'm reading the answers, currently
<Corsac> but what I see is that there is no real procedure to rebuild initfs
<Corsac> the common way seems to use a loop device with a jffs2 filesystem, put
         original files there, and add other files, then umount, flash and pray
   <dwd> Corsac: You forgot "ritual sacrifice of a medium sized rodent".
         Without that, it'll never work.
   <zuh> And if it doesn't work the first time, re-adjust towel ordering in the
         restroom and try again
                -- #maemo

Attachment: signature.asc
Description: Digital signature

Zope3-users mailing list

Reply via email to