Skip to content

Commit

Permalink
remove duplicative transformation function DT2dt, use plone.event.uti…
Browse files Browse the repository at this point in the history
…ls.pydt() instead, as both behave similarly with respect to timezone and DST in conversion.
  • Loading branch information
seanupton committed Aug 22, 2012
1 parent 994224f commit 44544a9
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions plone/app/event/base.py
Expand Up @@ -252,21 +252,7 @@ def guess_date_from(datestr, context=None):
return pytz.timezone(default_timezone(context)).localize(dateobj)


def DT2dt(v):
dt = v
if isinstance(v, date):
dt = datetime(*v.timetuple()[:3])
elif isinstance(v, DateTime):
dt = v.asdatetime()
tz = dt.tzinfo
if not tz:
return dt
else:
tz = dt.tzinfo
return tz.localize(datetime(*dt.timetuple()[:7]))


_strftime = lambda v, fmt: DT2dt(v).strftime(fmt)
_strftime = lambda v, fmt: pydt(v).strftime(fmt)


class PatchedDateTime(DateTime):
Expand Down

0 comments on commit 44544a9

Please sign in to comment.