[PEAK] No attribute 'register' error when calling
setParentComponent()
Phillip J. Eby
pje at telecommunity.com
Sat Oct 30 18:02:21 EDT 2004
At 08:39 PM 10/30/04 +0200, jdutreve at free.fr wrote:
>Hi all,
>
>I'm developping a domain model with accounts and I have an error
>when I've added element.setParentComponent(parent, element.name) :
The parent component of a model.Element must be an IPersistentDataManager
(see peak.persistence.interfaces). In other words, the parent component of
an Element is its DataManager. This is automatically taken care of if you
are using a DM to create and manage the instances.
Note that the idea of "parent component" in PEAK is to provide a context
for obtaining configuration and services. Ordinarily, domain model classes
do not provide configuration and services, but may need to access
them. So, every Element has its DM as a context, but Elements should not
ordinarily have other elements as parents in this sense.
The specific problem you are having is that an Element notifies its DM
(parent component) of changes via a 'register' method. If you really want
to overlap parent componentness onto model elements, you will need to
delegate the various IPersistentDataManager methods up the hierarchy until
they reach an actual DM. Even then, you may still encounter other issues,
as some DM methods expect an element's '_p_jar' to refer directly to the DM
itself.
More information about the PEAK
mailing list