UploadedFile API changes (was: Is it UploadedFile.chunks() or .chunk() ?)

6 views
Skip to first unread message

Jacob Kaplan-Moss

unread,
Jul 3, 2008, 12:22:53 PM7/3/08
to django-d...@googlegroups.com
On Thu, Jul 3, 2008 at 11:08 AM, Luke Plant <L.Pla...@cantab.net> wrote:
> The docs say '.chunks()' , which makes more sense to me, but the code
> says '.chunk()' (2 * for implementation, 1 * used)
>
> It's not too late to fix the code, otherwise the docs need changing.

I just talked about this with Mike on IRC; I think chunk() is
non-obvious and we're gonna change it to chunks(). Hopefully nobody's
written so much code in the last week to be pissed.

Also, we're going to change UploadedFile.file_name to
UploadedFile.name to more closely match the built-in file API.

Sorry about not thinking this through fully before committing, but
it's gonna be better this way.

Jacob

Marty Alchin

unread,
Jul 3, 2008, 1:03:27 PM7/3/08
to django-d...@googlegroups.com
On Thu, Jul 3, 2008 at 12:22 PM, Jacob Kaplan-Moss
<jacob.ka...@gmail.com> wrote:
> I just talked about this with Mike on IRC; I think chunk() is
> non-obvious and we're gonna change it to chunks(). Hopefully nobody's
> written so much code in the last week to be pissed.
>
> Also, we're going to change UploadedFile.file_name to
> UploadedFile.name to more closely match the built-in file API.
>
> Sorry about not thinking this through fully before committing, but
> it's gonna be better this way.

Well, as long as the floor's open, I'd like to make sure file storage
code is consistent. Currently, it uses filename instead of file_name
or just name, and it also uses size instead of file_size. I assume I
should go with name instead of filename, but should I use file_size,
or should the upload stuff use size?

On a related note, when merging #5361 with the new trunk, should the
file-related code, such as moving files and whatnot, be moved into
django.core.filestorage.filesystem? Also, should the code in
django.core.filestorage be moved over to the new django.core.files
package instead?

So many bikesheds, so little time.

-Gul

Jacob Kaplan-Moss

unread,
Jul 3, 2008, 2:18:08 PM7/3/08
to django-d...@googlegroups.com
On Thu, Jul 3, 2008 at 12:03 PM, Marty Alchin <gulo...@gamemusic.org> wrote:
> Well, as long as the floor's open, I'd like to make sure file storage
> code is consistent. Currently, it uses filename instead of file_name
> or just name, and it also uses size instead of file_size. I assume I
> should go with name instead of filename, but should I use file_size,
> or should the upload stuff use size?

Yeah, let's be consistent and use "size" and "name" everywhere. In
retrospect that beginning "file_" was redundant; my bad, sorry to have
to change it!

> On a related note, when merging #5361 with the new trunk, should the
> file-related code, such as moving files and whatnot, be moved into
> django.core.filestorage.filesystem? Also, should the code in
> django.core.filestorage be moved over to the new django.core.files
> package instead?

Let's put everything file-related in django.core.files -- no need for
both locations. We won't include support for any particular
network-based file storage in django.core (that'd go in contrib,
maybe) so there's no need to qualify the filesystem part.

Jacob

Reply all
Reply to author
Forward
0 new messages