fix: browserView getData setting for boolean field

This commit is contained in:
hplattner 2013-01-14 12:05:29 +01:00
parent 17e86e64c7
commit 9e8ba76461
3 changed files with 13 additions and 2 deletions

View file

@ -334,7 +334,7 @@ class EmailFieldInstance(FieldInstance):
class BooleanFieldInstance(FieldInstance): class BooleanFieldInstance(FieldInstance):
def marshall(self, value): def marshall(self, value):
return value return bool(value)
def display(self, value): def display(self, value):
#return value and _(u'Yes') or _(u'No') #return value and _(u'Yes') or _(u'No')

View file

@ -55,7 +55,7 @@ class Instance(BaseInstance):
fi = f.getFieldInstance(self, context=kw.get('context'), fi = f.getFieldInstance(self, context=kw.get('context'),
request=kw.get('request')) request=kw.get('request'))
name = f.name name = f.name
value = getattr(self.context, name) or fi.default value = getattr(self.context, name, fi.default)
if mode in ('view', 'preview'): if mode in ('view', 'preview'):
value = fi.display(value) value = fi.display(value)
else: else:

View file

@ -65,3 +65,14 @@ def year(d=None):
if d is None: if d is None:
d = datetime.today() d = datetime.today()
return d.year return d.year
def month(d=None):
if d is None:
d = datetime.today()
return d.month
def day(d=None):
if d is None:
d = datetime.today()
return d.day