Changeset 7856 for main/waeup.kofa
- Timestamp:
- 12 Mar 2012, 17:10:32 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/widgets/phonewidget.py
r7852 r7856 8 8 will be used for rendering). 9 9 10 The code was mainly taken from usphone implementation in z3c.widget11 (which was designed for outdated zope.app.form (instead of12 zope.formlib or newer form libs). Therefore some modifications were13 neccessary and it might look a bit overloaded.14 15 10 If you use the PhoneWidget for rendering regular TextLine attributes 16 11 (preferably in edit forms or add forms), the phone number is displayed 17 12 by three input fields representing the international code, the area 18 code and the extension line. All three fields require pure numbers as 19 input and do not accept other chars. 13 code and the extension line. 20 14 21 15 When the entered input is stored with a context object, it is stored 22 16 as a single unicode string with the numbers divided by single hyphen. 23 17 24 So, input < 12>, <111>, <444> becomes the string ``'12-111-444'`` for18 So, input <+12>, <111>, <444> becomes the string ``'+12-111-444'`` for 25 19 the context object. 26 27 Large parts of this module are copied from z3c.widget and may be28 covered by ZPL.29 30 20 """ 31 21 import grok 32 22 import re 33 import copy 34 from waeup.kofa.interfaces import MessageFactory as _ 35 from zope import schema 36 from zope.browserpage import ViewPageTemplateFile 37 from zope.component import getMultiAdapter 38 from zope.formlib import form 39 from zope.formlib.interfaces import ( 40 IBrowserWidget, IWidgetInputErrorView, IInputWidget, WidgetInputError, 41 MissingInputError) 42 from zope.formlib.widget import SimpleInputWidget 43 from zope.interface import Interface, implements 44 from zope.schema.interfaces import RequiredMissing 45 46 47 from zc.sourcefactory.contextual import BasicContextualSourceFactory 23 from zope.component import getUtility 24 from zope.formlib.interfaces import MissingInputError, InputErrors 25 from zope.interface import Interface 48 26 from zope.formlib.textwidgets import ( 49 27 TextWidget, renderElement, ConversionError) 50 from zope.formlib.widget import ValidationError51 from zope.component import getUtility52 from zope.interface import Invalid53 from zope.formlib.interfaces import (54 WidgetInputError, MissingInputError, InputErrors,)55 from zope.schema.interfaces import RequiredMissing56 28 from waeup.kofa.interfaces import MessageFactory as _ 57 29
Note: See TracChangeset for help on using the changeset viewer.