Roundup Tracker - Issues

Issue 1208946

classification
Define default property content in schema
Type: rfe Severity: normal
Components: Database Versions:
process
Status: fixed fixed
:
: richard : ThomasAH, richard
Priority: normal :

Created on 2005-05-26 07:18 by anonymous, last changed 2014-05-19 10:28 by ThomasAH.

Messages
msg3378 Author: [hidden] (anonymous) Date: 2005-05-26 07:18
Hi Richard,

Could it be possible to define a default property value
in the schema?
We often need to add new properties to a class. This
will result in none set values for all existing nodes
in that class. To set them I need to create a update
script which will step trough all existing nodes. This
is time consuming (writing the script, test it and
finally run it).
Could it be made possible to define default values in
the schema like:

user = Class(db, 'user',
                   in_office=Boolean(default=True),
                   login_counts=Number(default=0),
                   company=String(default='Waltdisney'))

If 'default' isn't supplied, no default will be set.
But if supplied, then it will be honored.

Regards,
Marlon
msg5102 Author: [hidden] (ThomasAH) Date: 2014-05-19 10:28
This is possible since Roundup 1.4.17:

changeset:   4481:9bbf3758c16a
user:        Stefan Seefeld <stefan@seefeld.name>
date:        Thu Apr 14 12:47:48 2011 +0000
files:       roundup/cgi/templating.py roundup/hyperdb.py
description:
Allow default value declaration in DB schema.


The value is declared with like this in schema.py:
  value=String(default_value="something")
  status=Link("wpstatus", default_value=1))
History
Date User Action Args
2014-05-19 10:28:39ThomasAHsetstatus: open -> fixed
resolution: fixed
messages: + msg5102
2014-05-16 07:25:30ThomasAHsetnosy: + ThomasAH
2005-05-26 07:18:50anonymouscreate