Closed electroniceagle closed 10 years ago
You're casting SHOP_DASHBOARD_URL into a string for pdb, so PrefProxy triggers str(), giving SHOP_DASHBOARD_URL = /dashboard
as expected. You'd better use call(), but direct get_value() will do as well.
Nevertheless we can upgrade str machinery: thus the current str will go into repr, so a new str might provide some other logic.
Thanks for the help! Maybe my pdb example was misleading. What we hit was:
return HttpResponseRedirect(SHOP_DASHBOARD_URL)
redirected to this:
http://localhost:8000/en/shop/checkout/SHOP_DASHBOARD_URL%20=%20/sessions
Using the settings.py taken from your doc example seems inconsistent if that is the intended behavior. Without siteprefs you get 'bar', with siteprefs you get 'foo = bar'.
The thing is that you're using reverse_lazy() that returns a proxy itself - it evaluates a result only as required. HttpResponseRedirect expects a string so it casts a proxy into a string.
Examples from the docs use plain objects not proxies and are consistent from that point of view.
Now I'll do some changes so taht you could verify they work.
You can try now.
Thanks! I understand now. Completely forgot about the reverse_lazy().
That worked, thanks.
On May 9, 2014, at 11:15 AM, Igor Starikov notifications@github.com wrote:
Is 51623e2 of any help?
— Reply to this email directly or view it on GitHub.
This is probably my own misunderstanding, but the setting returns a string "SHOP_DASHBOARD_URL = /dashboard", rather than "/dashboard". Our workaround is to call .get_value() on the PrefProxy object, but not sure this is expected behavior.
We have this settings.py:
and then in views.py: