Changeset 8151 for main/waeup.kofa/trunk


Ignore:
Timestamp:
14 Apr 2012, 14:03:40 (13 years ago)
Author:
uli
Message:

Use None as default for FormattedDate? schema type. This way a widget can decide, whether a date format was set explicitly for this field or not.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/schema
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/schema/field.py

    r8146 r8151  
    139139    `date_format`
    140140      additional attribute to describe desired date format. Must be a
    141       string that can be fed to strftime/strptime functions.
     141      string that can be fed to strftime/strptime functions. By
     142      default `None`.
    142143
    143144    `show_year`
    144145      boolean indicating whether some kind of year selection should
    145       be used with this instance.
     146      be used with this instance. `False` by default.
    146147    """
    147148    implements(IFormattedDate)
    148     date_format = '%Y-%m-%d'
     149    date_format = None
    149150    show_year = False
    150     def __init__(self, date_format='%Y-%m-%d', show_year=False, *args, **kw):
     151    def __init__(self, date_format=None, show_year=False, *args, **kw):
    151152        self.date_format = date_format
    152153        self.show_year = show_year
  • main/waeup.kofa/trunk/src/waeup/kofa/schema/tests/test_fields.py

    r8146 r8151  
    2323        obj = FormattedDate()
    2424        self.assertEqual(obj.show_year, False)
    25         self.assertEqual(obj.date_format, '%Y-%m-%d')
     25        self.assertEqual(obj.date_format, None)
    2626        return
    2727
Note: See TracChangeset for help on using the changeset viewer.