Filipe wrote:
>From the documentation for HttpResponse (http://www.djangoproject.com/documentation/request_response/):Ian Holsman wrote: But if you want to add content incrementally, you can use response as a file-like object: >>> response = HttpResponse()
>>> response.write("<p>Here's the text of the Web page.</p>")
>>> response.write("<p>Here's another paragraph.</p>")
This is an example of Python's "duck typing". Because HttpResponse implements the same methods as a file, it can be used in any place that a file can be used. PIL's save() method expects a file, but all it does is call write() (and maybe some other file methods). HttpResponse implements those methods with appropriate semantics, so it's known as "file-like", and can be used as a file can be used. --Ned. -- Ned Batchelder, http://nedbatchelder.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" 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-users -~----------~----~----~----~------~----~------~--~--- |
- Re: Returning images with Django Filipe
- Re: Returning images with Django Ned Batchelder

