On Fri, 2009-02-27 at 05:06 -0800, phoebebright wrote:
> Took me a long long time to work out why the .kml file I created in
> django would parse as valid in Feedburner but googlemaps said it was
> an invalid kml file.  Need to be sending as correct content-type of
> course.

[...]
> view
> ====
> def generateKml(request):
> 
>     locations = Location.objects.all().values('name','lat','longt')
> 
>     result= render_to_response('locations.kml',{
>         'locations': locations
>         })
> 
>     return HttpResponse(result,mimetype='Content-Type:application/
> vnd.google-earth.kml+xml')

Coming very late to the party here, but it's good to see this written
up. However, (as Eric Florenzano just pointed out to me) the "mimetype"
parameter doesn't look quite right. You don't need to specify the header
name, since Django puts the contents of the mimetype parameter into the
Content-Type header (and gives it the right name). So I suspect this
might be generating slightly bad HTTP headers. Just removing the
"Content-Type:" prefix from that string would fix it.

Thanks for posting your solution, in any case. It's nice to see this
stuff in use and, you're right that the trick is finding and using the
correct MIME type.

Regards,
Malcolm



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

Reply via email to