Changeset 8146
- Timestamp:
- 13 Apr 2012, 16:17:26 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/schema
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/schema/field.py
r7263 r8146 19 19 """ 20 20 from zope.interface import implements 21 from zope.schema import TextLine 21 from zope.schema import TextLine, Date 22 22 from zope.schema.interfaces import ( 23 23 ITextLine, IBaseVocabulary, ISource, IContextSourceBinder, InvalidValue,) 24 24 from zope.schema.vocabulary import ( 25 25 SimpleVocabulary, getVocabularyRegistry, VocabularyRegistryError) 26 from waeup.kofa.schema.interfaces import IFormattedDate 26 27 27 28 class CustomizableErrorMsg(object): … … 125 126 raise InvalidValue(value) 126 127 return 128 129 class FormattedDate(Date): 130 """A date field that supports additional formatting attributes. 131 132 Stores extra attributes (see below). To make use of these 133 attributes in forms, you have to provide widgets that read them 134 and use them in their operations, for instance the 135 `waeup.kofa.widgets.datewidget.FormattedDateWidget`. 136 137 Extra attributes are as follows: 138 139 `date_format` 140 additional attribute to describe desired date format. Must be a 141 string that can be fed to strftime/strptime functions. 142 143 `show_year` 144 boolean indicating whether some kind of year selection should 145 be used with this instance. 146 """ 147 implements(IFormattedDate) 148 date_format = '%Y-%m-%d' 149 show_year = False 150 def __init__(self, date_format='%Y-%m-%d', show_year=False, *args, **kw): 151 self.date_format = date_format 152 self.show_year = show_year 153 return super(FormattedDate, self).__init__(*args, **kw)
Note: See TracChangeset for help on using the changeset viewer.