equal
deleted
inserted
replaced
11 |
11 |
12 from warnings import warn |
12 from warnings import warn |
13 from datetime import datetime |
13 from datetime import datetime |
14 |
14 |
15 from logilab.mtconverter import xml_escape |
15 from logilab.mtconverter import xml_escape |
|
16 from logilab.common.date import ustrftime |
16 from logilab.common.decorators import cached |
17 from logilab.common.decorators import cached |
17 |
18 |
18 from yams.schema import KNOWN_METAATTRIBUTES |
19 from yams.schema import KNOWN_METAATTRIBUTES |
19 from yams.constraints import (SizeConstraint, StaticVocabularyConstraint, |
20 from yams.constraints import (SizeConstraint, StaticVocabularyConstraint, |
20 FormatConstraint) |
21 FormatConstraint) |
21 |
22 |
22 from cubicweb import Binary, tags, uilib, utils |
23 from cubicweb import Binary, tags, uilib |
23 from cubicweb.web import INTERNAL_FIELD_VALUE, ProcessFormError, eid_param, \ |
24 from cubicweb.web import INTERNAL_FIELD_VALUE, ProcessFormError, eid_param, \ |
24 formwidgets as fw |
25 formwidgets as fw |
25 |
26 |
26 |
27 |
27 class UnmodifiedField(Exception): |
28 class UnmodifiedField(Exception): |
668 format_prop = 'ui.date-format' |
669 format_prop = 'ui.date-format' |
669 etype = 'Date' |
670 etype = 'Date' |
670 |
671 |
671 def format_single_value(self, req, value): |
672 def format_single_value(self, req, value): |
672 if value: |
673 if value: |
673 return utils.ustrftime(value, req.property_value(self.format_prop)) |
674 return ustrftime(value, req.property_value(self.format_prop)) |
674 return u'' |
675 return u'' |
675 |
676 |
676 def render_example(self, req): |
677 def render_example(self, req): |
677 return self.format_single_value(req, datetime.now()) |
678 return self.format_single_value(req, datetime.now()) |
678 |
679 |