﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
12595	Localflavor bad arguments handling	Sayane	Jannis Leidel	"A lot of form fields in django.contrib.localflavor handles arguments to {{{__init__()}}} in a bad way.

{{{
    def __init__(self, *args, **kwargs):
        super(PLPESELField, self).__init__(r'^\d{11}$',
            max_length=None, min_length=None, *args, **kwargs)
}}}

Every line like first one should be fixed like this:

{{{
    def __init__(self, max_length=None, min_length=None, *args, **kwargs):
}}}

Because if someone will pass {{{max_length}}} or {{{min_length}}} argument to {{{__init__()}}} it will fail (multiple {{{min_length}}}/{{{max_length}}} arguments - additional one will be in {{{kwargs}}}).

It is a big problem, if i'm trying to do something like this:

{{{
class PostalCodeField(models.CharField):
    def formfield(self, **kwargs):
        kwargs.setdefault(""form_class"", PLPostalCodeField)
        return super(self.__class__, self).formfield(**kwargs)
}}}
because {{{django.db.models.CharField}}} sets {{{max_length}}} to {{{self.max_length}}}.

I'm attaching patch to fix polish localflavor."	Bug	closed	contrib.localflavor		Normal	fixed		say4ne@… Mike Fogel	Ready for checkin	1	0	0	0	0	0
