Changeset 6868 for main


Ignore:
Timestamp:
10 Oct 2011, 15:18:08 (13 years ago)
Author:
Henrik Bettermann
Message:

We don't need the class FormattedDatetimeDisplayWidget?. The FriendlyDatetimeDisplayWidget? function can also use the FormattedDateDisplayWidget? class instead.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/widgets/datewidget.py

    r6867 r6868  
    6969            return ""
    7070        content = content.strftime(self.date_format)
    71         return renderElement("span", contents=escape(content),
    72                              cssClass=self.cssClass)
    73 
    74 class FormattedDatetimeDisplayWidget(DatetimeDisplayWidget):
    75     """A datetime widget that supports different (and _explicit_) date formats.
    76 
    77     This is a display widget.
    78     """
    79     datetime_format = '%Y-%m-%d %H:%M:%S'
    80     implements(IDisplayWidget)
    81 
    82     def __call__(self):
    83         if self._renderedValueSet():
    84             content = self._data
    85         else:
    86             content = self.context.default
    87         if content == self.context.missing_value:
    88             return ""
    89         content = content.strftime(self.datetime_format)
    9071        return renderElement("span", contents=escape(content),
    9172                             cssClass=self.cssClass)
     
    172153
    173154    Valid `format` values are the keys of :var:`DATE_FORMATS`
    174     dict. Default is ``le`` (little endian; DD/MM/YYYY).
     155    dict. Default is ``le`` (little endian; DD/MM/YYYY %H:%M:%S).
    175156
    176157    This widget is not rendered with a specialized CSS tag for
     
    181162    datetime_format = date_format + ' %H:%M:%S'
    182163    return CustomWidgetFactory(
    183         FormattedDatetimeDisplayWidget,
    184         datetime_format=datetime_format)
     164        FormattedDateDisplayWidget,
     165        date_format=datetime_format)
Note: See TracChangeset for help on using the changeset viewer.