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

Phillip J. Eby pje at telecommunity.com
Fri May 17 08:11:25 EDT 2002

At 02:08 PM 5/17/02 +0200, Ulrich Eck wrote:

>when adding types to records (setType) the record is not registered in the 

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 

>in _setTypeFor i initially used record.loadDefaults + record.updateTypeMap
>to write the default values into the record .. (this may make sense when
>using DataModel with SQL+Schema, where default values are in DB.
>For the LDAPModel this does not really make sense, because there is no
>default-value definiton possible for schemas.)
>The question is, which attribute need to be set to
>which default-value ... the attribute-names can be taken from loadAttrs
>of RecordType or from the Schema-Definition. but if i set them all to
>e.g. [] the feature.defaultValue of an Element's feature will never be
>used. should i set the attributes to [] as default at all,
>or should basically a feature use _fData.setdefault(key,feature.defaultValue)
>to access the values ???

The DataModel really needs to supply default values, as they are an 
implementation-level aspect.  If you think about this for a bit, with 
regard to association features (as opposed to value features), you'll 
realize why.

In the case of LDAP, this just means that your RecordType implementations 
need some support for default values as part of their metadata.

More information about the PEAK mailing list