oship-dev team mailing list archive
-
oship-dev team
-
Mailing list archive
-
Message #01445
Re: [Bug 614863] Re: openehr.Pathable class needs parent() and name() methods
Em 01/09/10 14:49, Tim Cook escreveu:
> On Wed, 2010-09-01 at 16:38 +0000, Diego Manhães Pinheiro wrote:
>> Em 01/09/10 12:43, Eduardo César escreveu:
>>> Wagner, I put a "parent=None" in the constructor of the Locatable class to
>>> address those issues and the other bugs. I did not commit yet because some
>>> tests are still failing after I did this. I don't know if that one is a good
>>> approach either, maybe we can exchange some ideas about this matter.
>>>
>> Use a method instead of an attribute sounds better,IHMO. Use a method
>> allows avoid unexpected states in a clear form. An important thing that
>> you must have keep in mind that the __parent__ and __name__ are related
>> to the zope container mechanism. It means that when a code like this "
>> container[name] = locatable" is called a will redefining the the parent
>> which will be container and __name__ will be the archetypeNodeId .
>> This is defined using the zope event system.
>> Summarizing: those attributes can be overriden without you expected.
>> Be careful when you define then.
>>
>
> But Diego. You WANT the Zope container to have control. That is what
> connects the objects to the catalog system too; correct?
Yes, that's right. The catalog system is connected with certain events
which is only triggered when you add a object to a container.
Everytime that you add a object to a object container, events are
triggered both by container and by the object. The __name__ and
__parent__ are defined using events. Object are cataloged using other
events too.
The point is then you define something on these attributes in a object
during object initialization time and after that set it in a Grok
container which IS NOT a Locatable object, the attributes probably will
be overridden and will generate an weird behavior.
>
> --Tim
>
>
>
Attachment:
0xF860E73C.asc
Description: application/pgp-keys
Follow ups
References