Changeset 6068
- Timestamp:
- 09/08/07 14:26:15 (1 year ago)
- Files:
-
- django/trunk/django/core/validators.py (modified) (6 diffs)
- django/trunk/django/newforms/fields.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/core/validators.py
r6067 r6068 10 10 11 11 import urllib2 12 from django.conf import settings13 from django.utils.translation import ugettext as _, ugettext_lazy, ungettext14 from django.utils.functional import Promise, lazy15 from django.utils.encoding import force_unicode16 12 import re 17 13 try: … … 19 15 except ImportError: 20 16 from django.utils._decimal import Decimal, DecimalException # Python 2.3 17 18 from django.conf import settings 19 from django.utils.translation import ugettext as _, ugettext_lazy, ungettext 20 from django.utils.functional import Promise, lazy 21 from django.utils.encoding import force_unicode 21 22 22 23 _datere = r'\d{4}-\d{1,2}-\d{1,2}' … … 149 150 except ValueError, e: 150 151 msg = _('Invalid date: %s') % _(str(e)) 151 raise ValidationError, msg 152 raise ValidationError, msg 152 153 153 154 def isValidANSIDate(field_data, all_data): … … 252 253 except: # urllib2.URLError, httplib.InvalidURL, etc. 253 254 raise ValidationError, _("The URL %s is a broken link.") % field_data 254 255 255 256 def isValidUSState(field_data, all_data): 256 257 "Checks that the given string is a valid two-letter U.S. state abbreviation" … … 381 382 382 383 def __call__(self, field_data, all_data): 383 # Try to make the value numeric. If this fails, we assume another 384 # Try to make the value numeric. If this fails, we assume another 384 385 # validator will catch the problem. 385 386 try: … … 387 388 except ValueError: 388 389 return 389 390 390 391 # Now validate 391 392 if self.lower and self.upper and (val < self.lower or val > self.upper): django/trunk/django/newforms/fields.py
r6067 r6068 354 354 self.filename = filename 355 355 self.content = content 356 356 357 357 def __unicode__(self): 358 358 """ … … 397 397 raise ValidationError(ugettext(u"Upload a valid image. The file you uploaded was either not an image or a corrupted image.")) 398 398 return f 399 399 400 400 class URLField(RegexField): 401 401 def __init__(self, max_length=None, min_length=None, verify_exists=False, … … 527 527 """ 528 528 A Field that aggregates the logic of multiple Fields. 529 529 530 530 Its clean() method takes a "decompressed" list of values, which are then 531 531 cleaned into a single value according to self.fields. Each value in
