On 16 Sep 2006, at 13:39, Malcolm Tredinnick wrote:

Are you sure it's really getting to that last line and not returning

somewhere earlier?


Yes...

Does request.META['HTTP_REFERER'] contain something sensible? This won't

be the cause of the problem, but it's worth checking.


Most of the time... sometimes of course it is empty. I have tried passing the url to redirect to explicitly and HttpResponseRedirect still errors..

If I hard code a url in... it works... but I have used a template to render out the referer and it's fine...

If you trim it down to just returning the redirect instance and/or

hard-code in the string to redirect to, does the error go away?


No

Something in the bits you have waved your hands over is causing the

problem here, by the looks of it. So start weeding out as much as you

can until it starts working and then it you might get a few more clues

as to what is going on.


OK. excuse my poor code... but here's my method that (actually passes the url urlencoded and ) tries to alter a session variable which contains a list of sites to ignore... this method  deletes one of them from that list....

from django.http import  HttpResponseRedirect, HttpResponse
def reinstate_site(request, site, url):
try:
notsitelist = request.session['notsitelist']
except:
notsitelist = [ ] # if doesn't exist yet...
i = 0
for notsite in notsitelist:
if site == notsite:
del notsitelist[i]
i+=1
request.session['notsitelist'] = notsitelist
return HttpResponseRedirect(url)

I have also tried using request.META[HTTP_REFERER'] with this approach and get the same






--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to