#3512: [patch] Add HTML classes to fields in newforms as_methods: "required" &
"error"
-------------------------------------------------+--------------------------
Reporter: Waylan Limberg <[EMAIL PROTECTED]> | Owner:
adrian
Status: new | Component:
django.newforms
Version: SVN | Resolution:
Keywords: | Stage:
Design decision needed
Has_patch: 1 | Needs_docs: 1
Needs_tests: 1 | Needs_better_patch: 0
-------------------------------------------------+--------------------------
Comment (by mtredinnick):
The latest patch in this sequence has a bug that would need to be fixed:
using mutable objects (such as []) as default arguments to functions is
wrong. They are created once at import time and exist in the module's
scope (not the function body). So if you accidently change them in place,
the changes just accumulate each time the function is called.
This is why the bug in comment 5 is occurring (because it is assinging, by
reference, a module-level object). Pass in a default of None and check it
inside the function body. If the arg is None, assign an empty list to it.
I'm still trying to make sense of all the differences between this #3515
at the moment, but I wanted to note the problem while I remember it.
--
Ticket URL: <http://code.djangoproject.com/ticket/3512#comment:8>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---