[Checkins] SVN: grok/trunk/src/grok/ set fields to the default
value, not None
Wolfgang Schnerring
wosc at wosc.de
Thu Oct 19 08:15:41 EDT 2006
Log message for revision 70807:
set fields to the default value, not None
Changed:
U grok/trunk/src/grok/components.py
U grok/trunk/src/grok/tests/form/form.py
-=-
Modified: grok/trunk/src/grok/components.py
===================================================================
--- grok/trunk/src/grok/components.py 2006-10-19 12:12:21 UTC (rev 70806)
+++ grok/trunk/src/grok/components.py 2006-10-19 12:15:41 UTC (rev 70807)
@@ -42,7 +42,7 @@
instance = super(Model, class_).__new__(class_, args, kw)
for field in schema_fields(instance):
- setattr(instance, field.__name__, None)
+ setattr(instance, field.__name__, field.default)
return instance
Modified: grok/trunk/src/grok/tests/form/form.py
===================================================================
--- grok/trunk/src/grok/tests/form/form.py 2006-10-19 12:12:21 UTC (rev 70806)
+++ grok/trunk/src/grok/tests/form/form.py 2006-10-19 12:15:41 UTC (rev 70807)
@@ -8,7 +8,7 @@
>>> print manfred.name
None
>>> print manfred.size
- None
+ Quite normal
>>> manfred.somethingelse
Traceback (most recent call last):
...
@@ -38,7 +38,7 @@
class Mammoth(grok.Model):
class fields:
name = schema.TextLine(title=u"Name")
- size = schema.TextLine(title=u"Size")
+ size = schema.TextLine(title=u"Size", default=u"Quite normal")
somethingelse = None
class Edit(grok.EditForm):
More information about the Checkins
mailing list