Please note: this project is inactive since early 2006

 
2.4.6.5 APrimaryKey

The component APrimaryKey redefines the following defaults:

Prop.  Type  Default  Comment 
name string no default The name is the only mandatory arguments when instanciating a APrimaryKey. Once set, it should not be changed
isClassProperty int 0  
isRequired int 1 You should not change this default, nor overwrite it: a primary key should be mandatory.
defaultValue   None if isClassProperty is false, 0 otherwise  
doc string 'Primary Key'  
usedForLocking int 0  

Note: For details about these properties and their meaning, please refer to 2.3.3.
Warning: If you want to make your primary keys class properties, please be sure to read the dedicated ''FAQ'' entry (B.1).

Every entity must define a primary key. However, most of the times, you do not want to explicitly declare a primary key in each of your entities, since they'll basically be the same. In this case, you'll simply add a primary key to the Entity's defaults:

Entity.defaults['properties'] = [
  APrimaryKey('id', isClassProperty=0, isRequired=1, doc='PK')
]
Every declared entity will then automatically get its own primary key -a clone of the default one.

Comments are welcome: Sebastien Bigaret / Modeling Home Page
Hosted by:SourceForge.net Logo