fix pretty_datetime helper

This commit is contained in:
Lance Edgar 2012-08-03 10:23:16 -07:00
parent 2685759932
commit c788601572

View file

@ -37,9 +37,9 @@ from webhelpers.html.tags import literal
import formalchemy
from formalchemy.validators import accepts_none
import edbob
from edbob.lib import pretty
from edbob.pyramid import Session, helpers
from edbob.time import localize
from edbob.pyramid.forms.formalchemy.fieldset import *
from edbob.pyramid.forms.formalchemy.grid import *
@ -114,7 +114,7 @@ def pretty_datetime(value, from_='local', to='local'):
if not isinstance(value, datetime.datetime):
return str(value) if value else ''
if not value.tzinfo:
value = edbob.local_time(value, from_=from_, to=to)
value = localize(value, from_=from_, to=to)
return literal('<span title="%s">%s</span>' % (
value.strftime('%Y-%m-%d %H:%M:%S %Z%z'),
pretty.date(value)))