merge remote hplattner
This commit is contained in:
commit
7940efc315
4 changed files with 16 additions and 3 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,2 +1,6 @@
|
||||||
*.pyc
|
*.pyc
|
||||||
ajax/dojo/*
|
ajax/dojo/*
|
||||||
|
.project
|
||||||
|
.pydevproject
|
||||||
|
.settings
|
||||||
|
|
||||||
|
|
|
@ -336,7 +336,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')
|
||||||
|
|
|
@ -53,7 +53,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:
|
||||||
|
|
11
util/date.py
11
util/date.py
|
@ -71,7 +71,6 @@ def year(d=None):
|
||||||
d = datetime.today()
|
d = datetime.today()
|
||||||
return d.year
|
return d.year
|
||||||
|
|
||||||
|
|
||||||
def toLocalTime(d):
|
def toLocalTime(d):
|
||||||
if pytz is None or not d:
|
if pytz is None or not d:
|
||||||
return d
|
return d
|
||||||
|
@ -82,3 +81,13 @@ def toLocalTime(d):
|
||||||
return d.astimezone(cet)
|
return d.astimezone(cet)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
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
|
||||||
|
|
Loading…
Add table
Reference in a new issue