my bad, of course, the patch should be:

Index: fields.py
===================================================================
--- fields.py   (revision 4256)
+++ fields.py   (working copy)
@@ -33,7 +33,7 @@
    # Tracks each time a Field instance is created. Used to retain
order.
    creation_counter = 0

-    def __init__(self, required=True, widget=None, label=None,
initial=None):
+    def __init__(self, required=True, widget=None, label=None,
initial=None, validator_list=[]):
        # required -- Boolean that specifies whether the field is
required.
        #             True by default.
        # widget -- A Widget class, or instance of a Widget class,
that should be
@@ -47,7 +47,7 @@
        #            *not* used as a fallback if data isn't given.
        if label is not None:
            label = smart_unicode(label)
-        self.required, self.label, self.initial = required, label,
initial
+        self.required, self.label, self.initial, self.validator_list =
required, label, initial, validator_list
        widget = widget or self.widget
        if isinstance(widget, type):
            widget = widget()
@@ -72,6 +72,9 @@
        """
        if self.required and value in EMPTY_VALUES:
            raise ValidationError(gettext(u'This field is required.'))
+        for validator in self.validator_list:
+            validator(value)
+
        return value

    def widget_attrs(self, widget):
@@ -83,9 +86,9 @@
        return {}

class CharField(Field):
-    def __init__(self, max_length=None, min_length=None,
required=True, widget=None, label=None, initial=None):
+    def __init__(self, max_length=None, min_length=None,
required=True, widget=None, label=None, initial=None,
validator_list=[]):
        self.max_length, self.min_length = max_length, min_length
-        Field.__init__(self, required, widget, label, initial)
+        Field.__init__(self, required, widget, label, initial,
validator_list)

    def clean(self, value):
        "Validates max_length and min_length. Returns a Unicode
object."


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to