On Wed, Apr 30, 2008 at 8:39 PM, msoulier <[EMAIL PROTECTED]> wrote: > > A coworker of mine created a form with a field called "data". > > ie. data = forms.CharField() > > This resulted in an exception being thrown when is_valid() was called > on the form: > > form error - 'dict' is not callable > > The exception occurs at line 180 in > <python install>\lib\site-packages\django\newforms\forms.py > > in Django 0.96. > > The reason is that the hasattr() call for "clean_data" returns true. > > We're just considering "data" as a reserved word in newforms now, but > I wanted to check to see if this was known. If so, I'd expect an error > saying so, instead of the cryptic one that we received. >
This appears to have been found and fixed, since the problem does not occur when using a fairly recent trunk level: Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> import django >>> django.get_version() u'0.97-pre-SVN-7501' >>> from django import newforms as forms >>> class DataForm(forms.Form): ... data = forms.CharField() ... >>> df = DataForm({'data': 'x'}) >>> df.is_valid() True Karen --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---