[TransWarp] Re: Transaction-Handling in DataModel and default values at creation time ...

Ulrich Eck ueck at net-labs.de
Tue May 21 09:16:30 EDT 2002

Hi Phillip,

--On Freitag, 17. Mai 2002 07:11 -0500 "Phillip J. Eby" 
<pje at telecommunity.com> wrote:

> It's up to the RecordType implementation to do this, if it's appropriate.
> Typically, upon setting a type, it's necessary to change an existing
> field, which will of course automatically effect registration.  In LDAP,
> when you change types you typically change the 'objectclass' field, so
> that takes care of it.  Just use the record's app-side interface rather
> than its service-side interface.  That is, use
> record['objectclass']=[whatever] rather than record.loadDefaults() or
> record.loadData().

Here we have the chicken and egg problem :)

in Datamodel __setitem___ is defined as followed:
def __setitem__(self, key, value):

        oldValue = self.data[key]  <------- raises if record is not 
initialized for this attribute


if I setType for a record i need to use loadDefaults/loadData to initialize 
it correctly,
but then  i still have the problem that it is not registered in the 

What is better in your opinion:
1. register a record when calling setType
2. loadDefaults first and then modify an attribute to be shure it's 
registered (don't like this one)
3. ???

another point that i'm not clear about:

when creating a record (setType for the firsttime) should the record be 
created (in DB)
in the setTypeFor method (using the Default-Values) or should _saveRecord 
 if record exists and add or modify it then (i use second approach yet)?


Ulrich Eck
net-labs Systemhaus GmbH
Ebersberger Str. 46
85570 Markt Schwaben
fon:   +49-8121-4747-11
fax:   +49-8121-4747-77
email: ueck at net-labs.de

More information about the PEAK mailing list