Code

Changes between Version 180 and Version 181 of BackwardsIncompatibleChanges


Ignore:
Timestamp:
07/07/08 16:27:07 (6 years ago)
Author:
jacob
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BackwardsIncompatibleChanges

    v180 v181  
    6060 * [7799] June 30, 2008 [#BooleanFieldsinnewformsenforcerequired BooleanFields in newforms enforce "required"] 
    6161 * [7806] June 30, 2008 [#DefaultUserorderingremoved Default User ordering removed] 
    62  * [7814] July 1, 2008 [#Uploadedfilechanges Uploaded file changes] 
     62 * [7814] July 1, 2008 & [7859] [#Uploadedfilechanges Uploaded file changes] 
    6363 * [7844] July 6, 2008 [#Translationtoolsnowpartofdjango-admin.py Translation tools now part of `django-admin.py`] 
     64 * [7859] July 7, 2008 [#Uploadedfilechanges More uploaded file changes]. 
    6465 
    6566== Database constraint names changed == 
     
    637638However, as part of the change, the representation of uploaded files has changed. Previous, uploaded files -- that is, entries in {{{request.FILES}}} -- were represented by simple dictionaries with a few well-known keys. Uploaded files are now represented by an [http://www.djangoproject.com/documentation/upload_handling/#uploaded-file-objects UploadedFile object], and thus the file's information is accessible through object attributes. Thus, given {{{f = request.FILES['some_field_name']}}}: 
    638639 
    639 || '''Old'''                            || '''New'''                    || 
    640 || {{{f['content']}}}           || {{{f.read()}}}               || 
    641 || {{{f['filename']}}}          || {{{f.file_name}}}    || 
    642 || {{{f['content-type']}}}      || {{{f.content_type}}} || 
     640|| '''Deprecated'''         || '''Replacement'''    || 
     641|| {{{f['content']}}}       || {{{f.read()}}}       || 
     642|| {{{f['filename']}}}      || {{{f.name}}}         || 
     643|| {{{f['content-type']}}}  || {{{f.content_type}}} || 
    643644 
    644645The old dictionary-style key access is still supported, but will raise a {{{DeprecationWarning}}}. 
     646 
     647[7859] further cleaned up and clarified this interface. It unfortunatly had to deprecate a couple of things added in [7814]: 
     648 
     649|| '''Deprecated'''  || '''Replacement'''                   || 
     650|| {{{f.file_name}}} || {{{f.name}}}                        || 
     651|| {{{f.file_size}}} || {{{f.size}}}                        || 
     652|| {{{f.chunk()}}}   || {{{f.chunks()}}} (note the plural)  || 
     653 
     654The old attributes will still work, but will issue deprecation warnings. 
     655 
     656Finally, [7859] removed the {{{django.newforms.fields.UploadedFile}}} class, unifying the use of {{{django.core.files.uploadedfile.UploadedFile}}} everywhere in Django. This means a few API changes when using a form with a {{{FileField}}}. 
     657 
     658|| '''Deprecated'''                                 || '''Replacement'''                              || 
     659|| {{{form.cleaned_data['file_field'].filename}}}   || {{{form.cleaned_data['file_field'].name}}}     || 
     660|| {{{form.cleaned_data['file_field'].data}}}       || {{{form.cleaned_data['file_field'].read()}}}   || 
    645661 
    646662== Translation tools now part of `django-admin.py` ==