Permalink
Browse files

remove duplicative transformation function DT2dt, use plone.event.uti…

…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 44544a9b42e8aa71696b260ea64b12cb243f91b1
Showing with 1 addition and 15 deletions.
  1. +1 −15 plone/app/event/base.py
View
@@ -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):

0 comments on commit 44544a9

Please sign in to comment.