Perfect! Thanks for the advice. I should have been using pdb with the
devserver a long time ago.

I used this screencast as a tutorial:
http://ericholscher.com/blog/2008/aug/31/using-pdb-python-debugger-django-debugging-series-/

As I stepped through my request, I realized that the Referer wasn't
getting set in the request headers.
I was trying to access the Referer like this:
request.META['HTTP_REFERER']
which was causing a key error.

So in my request view, I switched to this:

#determine the site the user is on
current_site = Site.objects.get_current()
#Create the headers
headers = {
    'Referer': "http://%s/comments/"; % (current_site.domain),
    }
#Create the request
req = urllib2.Request(url, data, headers)
#Send the request
response = urllib2.urlopen(req)

And I made my receiving view more forgiving:
referrer = request.META.get('HTTP_REFERER', 'None')

Thanks!
-Brandon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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