Changeset 7848 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 12 Mar 2012, 16:18:29 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/widgets/phonewidget.py
r7846 r7848 275 275 276 276 def title_value_list(self): 277 return sorted([('%s (+%s)' % (x,y), y)277 return sorted([('%s (+%s)' % (x,y), '+%s' % y) 278 278 for x,y in self._data]) 279 279 280 RE_INT_PREFIX = re.compile('^\+\d+') 280 281 RE_NUMBERS = re.compile('^\d+$') 281 282 RE_NUMBERS_AND_HYPHENS = re.compile('^[\d\-]+$') … … 363 364 _("Empty phone field(s)."), MissingInputError( 364 365 self.name, self.label, None)) 365 if not RE_NUMBERS.match(parts[1]) or not RE_NUMBERS_AND_HYPHENS.match( 366 parts[2]): 366 if parts[0] != '' and not RE_INT_PREFIX.match(parts[0]): 367 raise ConversionError( 368 _("Int. prefix requires format '+NNN'"), 369 ValueError('invalid international prefix')) 370 if (parts[1] != '' and not RE_NUMBERS.match(parts[1])) or ( 371 parts[2] != '' and not RE_NUMBERS_AND_HYPHENS.match( 372 parts[2])): 367 373 raise ConversionError( 368 374 _("Phone numbers may contain numbers only."), 369 375 ValueError('non numbers in phone number')) 376 if result in ('--', '', None): 377 result = self.context.missing_value 370 378 return result 371 379 … … 384 392 for name in self.subwidget_names] 385 393 ) 386 if form_value == '--':387 form_value = self._missing388 394 else: 389 395 form_value = self._toFormValue(input_value) … … 397 403 return False 398 404 return True 399
Note: See TracChangeset for help on using the changeset viewer.