Changeset 8171 for main/waeup.kofa/trunk
- Timestamp:
- 16 Apr 2012, 07:49:22 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/schema/field.py
r8166 r8171 24 24 from zope.schema.vocabulary import ( 25 25 SimpleVocabulary, getVocabularyRegistry, VocabularyRegistryError) 26 from waeup.kofa.schema.interfaces import IFormattedDate 26 from waeup.kofa.schema.interfaces import IFormattedDate, IPhoneNumber 27 27 28 28 class CustomizableErrorMsg(object): … … 153 153 self.show_year = show_year 154 154 return super(FormattedDate, self).__init__(*args, **kw) 155 156 class PhoneNumber(TextLine): 157 """A schema field for phone numbers. 158 """ 159 implements(IPhoneNumber) -
main/waeup.kofa/trunk/src/waeup/kofa/schema/interfaces.py
r8166 r8171 17 17 ## 18 18 from zope import schema 19 from zope.schema.interfaces import IDate 19 from zope.schema.interfaces import IDate, ITextLine 20 20 21 21 class IFormattedDate(IDate): … … 37 37 default = '%Y-%m-%d', 38 38 ) 39 40 class IPhoneNumber(ITextLine): 41 """A phone number. 42 """ -
main/waeup.kofa/trunk/src/waeup/kofa/schema/tests/test_fields.py
r8166 r8171 4 4 from zope.interface.verify import verifyClass, verifyObject 5 5 from zope.schema.interfaces import IDate 6 from waeup.kofa.schema import FormattedDate 7 from waeup.kofa.schema.interfaces import IFormattedDate 6 from waeup.kofa.schema import FormattedDate, PhoneNumber 7 from waeup.kofa.schema.interfaces import IFormattedDate, IPhoneNumber 8 8 9 9 class FormattedDateTests(unittest.TestCase): … … 32 32 self.assertEqual(obj.date_format, '%d.%m.%Y') 33 33 return 34 35 class PhoneNumberTests(unittest.TestCase): 36 # Tests for PhoneNumber field 37 def test_iface(self): 38 # make sure we fullfill interface contracts 39 obj = PhoneNumber() 40 verifyClass(IPhoneNumber, PhoneNumber) 41 verifyObject(IPhoneNumber, obj) 42 return -
main/waeup.kofa/trunk/src/waeup/kofa/widgets/overrides.zcml
r8166 r8171 25 25 /> 26 26 27 <!-- Register edit widget for PhoneNumbers --> 28 <adapter 29 for="waeup.kofa.schema.interfaces.IPhoneNumber 30 zope.publisher.interfaces.browser.IBrowserRequest" 31 provides="zope.formlib.interfaces.ISimpleInputWidget" 32 factory="waeup.kofa.widgets.phonewidget.PhoneWidget" 33 permission="zope.Public" 34 /> 35 27 36 </configure>
Note: See TracChangeset for help on using the changeset viewer.