On Oct 1, 11:06 am, David Cramer <[EMAIL PROTECTED]> wrote:
> I'm running into an issue when trying to pass a file-like object to
> HttpResponse and telling it to label it as "application/xml"
>
> def sitemap(request, sitemaps, section):
>     page = request.GET.get('p', 1)
>     fpath = os.path.join(settings.BASE_PATH + '/', 'cache/sitemap-%s-
> %s.xml' % (section, page))
>     if not os.path.exists(fpath):
>         raise Http404
>
>     return HttpResponse(open(fpath, 'r'), mimetype='application/xml')
>
> When added the mimetype, nothing gets sent to the browser. Removing it
> solves the issue, but then it has an invalid content type.

Nothing to do with your specific problem, but knowing how you always
want things to run as well as possible and how big your sitemap file
apparently is, may interest you to look at wsgi.file_wrapper
references in:

  http://code.djangoproject.com/wiki/Version1.1Features

One of the tickets (7894) has patch to allow static files to be
returned using more optimal means provided by mod_wsgi/mod_python,
ie., using sendfile() or other memory mapping techniques.

Graham
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to