[imp] merge nested tests in _dttime_format.__str__

bzr revid: xmo@tinyerp.com-20100214144204-0ary7dqew73j3jmr
This commit is contained in:
Xavier Morel 2010-02-14 15:42:04 +01:00
parent 210ac606ae
commit 858cec547b
1 changed files with 4 additions and 5 deletions

View File

@ -119,11 +119,10 @@ class _dttime_format(str, _format):
self.val = value and str(value) or ''
def __str__(self):
if self.val:
if getattr(self,'name', None):
return datetime.strptime(self.name, DHM_FORMAT)\
.strftime("%s %s"%(self.lang_obj.date_format,
self.lang_obj.time_format))
if self.val and getattr(self,'name', None):
return datetime.strptime(self.name, DHM_FORMAT)\
.strftime("%s %s"%(self.lang_obj.date_format,
self.lang_obj.time_format))
return self.val