hidden usage of datetime function which has been moved to lgc
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 05 Feb 2010 15:44:34 +0100
changeset 4481 56440a1f816a
parent 4480 6ca684648518
child 4482 1f4f33535d9a
hidden usage of datetime function which has been moved to lgc
web/formfields.py
web/formwidgets.py
--- a/web/formfields.py	Fri Feb 05 14:58:46 2010 +0100
+++ b/web/formfields.py	Fri Feb 05 15:44:34 2010 +0100
@@ -13,13 +13,14 @@
 from datetime import datetime
 
 from logilab.mtconverter import xml_escape
+from logilab.common.date import ustrftime
 from logilab.common.decorators import cached
 
 from yams.schema import KNOWN_METAATTRIBUTES
 from yams.constraints import (SizeConstraint, StaticVocabularyConstraint,
                               FormatConstraint)
 
-from cubicweb import Binary, tags, uilib, utils
+from cubicweb import Binary, tags, uilib
 from cubicweb.web import INTERNAL_FIELD_VALUE, ProcessFormError, eid_param, \
      formwidgets as fw
 
@@ -670,7 +671,7 @@
 
     def format_single_value(self, req, value):
         if value:
-            return utils.ustrftime(value, req.property_value(self.format_prop))
+            return ustrftime(value, req.property_value(self.format_prop))
         return u''
 
     def render_example(self, req):
--- a/web/formwidgets.py	Fri Feb 05 14:58:46 2010 +0100
+++ b/web/formwidgets.py	Fri Feb 05 15:44:34 2010 +0100
@@ -12,8 +12,9 @@
 
 from logilab.mtconverter import xml_escape
 from logilab.common.deprecation import deprecated
+from logilab.common.date import todatetime
 
-from cubicweb import tags, uilib, utils
+from cubicweb import tags, uilib
 from cubicweb.web import stdmsgs, INTERNAL_FIELD_VALUE, ProcessFormError
 
 class FieldWidget(object):
@@ -508,7 +509,7 @@
         timestr = req.form.get(field.input_name(form, 'time')).strip() or None
         if datestr is None:
             return None
-        date = utils.todatetime(req.parse_datetime(datestr, 'Date'))
+        date = todatetime(req.parse_datetime(datestr, 'Date'))
         if timestr is None:
             return date
         time = req.parse_datetime(timestr, 'Time')