logo       

using the stable api: msg#02308

DjangoUsers

Subject: using the stable api



Hi everybody,

I upgraded from somewhere around Django 1.0 to 1.0.2, and some things
broke and had to be changed. In the following, f is an object of class
'django.core.files.uploadedfile.TemporaryUploadedFile'. I need to

1) Get the contents of the file corresponding to f. I had to change
f['content'] to f._file.read()

>From the docs (specifically, 'core/files/uploadedfile.py') it looks like
f.read() might be the right thing?

2) Get the filename of the file corresponding to f. I had to change
f['filename'] to f._name.

3) Get the sessionid. I had to change request.COOKIES['sessionid'] to
request.COOKIES[settings.SESSION_COOKIE_NAME]

It is presumably better to use a stable API rather than less stable
internals, so my question is - what is the best expression to use in the
examples above so that they are less likely to break on upgrade? Please CC
me on any reply.

Regards, Faheem.

--~--~---------~--~----~------------~-------~--~----~
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@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
django-users+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | Mail Home | sitemap | FAQ | advertise