#3376: newforms.Form.clean_data is not read-only
----------------------------------+-----------------------------------------
   Reporter:  [EMAIL PROTECTED]  |                Owner:  adrian                
     Status:  new                 |            Component:  django.newforms      
 
    Version:  SVN                 |           Resolution:                       
 
   Keywords:                      |                Stage:  Design decision 
needed
  Has_patch:  0                   |           Needs_docs:  0                    
 
Needs_tests:  0                   |   Needs_better_patch:  0                    
 
----------------------------------+-----------------------------------------
Old description:

> Is it possible to make newforms.Form.clean_data immutable?  I'm kind of
> surprised it isn't, but I don't know the meaning or purpose of all
> things.
> 
> $ python manage.py shell
> Python 2.4.4c1 (#2, Oct 11 2006, 21:51:02)
> [GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
> >>> from django import newforms
> >>> class form(newforms.Form):
> ...   a = newforms.IntegerField()
> ...   b = newforms.CharField()
> ...
> >>> d = {'a': 1, 'b': 'field b'}
> >>> f = form(d)
> >>> f.is_valid()
> True
> >>> f.clean_data
> {'a': 1, 'b': u'field b'}
> >>> f.clean_data['a'] = 2
> >>> f.clean_data
> {'a': 2, 'b': u'field b'}
> >>>

New description:

 Is it possible to make newforms.Form.clean_data immutable?  I'm kind of
 surprised it isn't, but I don't know the meaning or purpose of all things.
 
 {{{
 $ python manage.py shell
 Python 2.4.4c1 (#2, Oct 11 2006, 21:51:02)
 [GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 (InteractiveConsole)
 >>> from django import newforms
 >>> class form(newforms.Form):
 ...   a = newforms.IntegerField()
 ...   b = newforms.CharField()
 ...
 >>> d = {'a': 1, 'b': 'field b'}
 >>> f = form(d)
 >>> f.is_valid()
 True
 >>> f.clean_data
 {'a': 1, 'b': u'field b'}
 >>> f.clean_data['a'] = 2
 >>> f.clean_data
 {'a': 2, 'b': u'field b'}
 }}}

Comment (by adrian):

 (Fixed formatting in description.)

-- 
Ticket URL: <http://code.djangoproject.com/ticket/3376#comment:5>
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to