On Wednesday, August 8, 2012 1:18:11 PM UTC-4, Massimo Di Pierro wrote:
>
> ok, I defaulted to type='http' as you did but I allowed a type='auto' as
> well.
>
Good idea. Actually, I'm not sure we need the separate "auto" option --
type='client' only makes sense for Ajax requests anyway, so why not just
make "client" behave like "auto" (i.e., when type == "client", ignore the
type unless it's an Ajax request):
from gluon import current
if type == 'client' and current.request.ajax:
raise HTTP(200, **{'web2py-redirect-location': location})
Also, I'm re-thinking whether we should go with a "type" argument that can
take multiple values or a simple boolean (e.g., client_side=True). I was
originally thinking "type" could be extended to take an "internal" value,
but perhaps client-side and internal should be considered to be independent
rather than mutually exclusive (i.e., you might want a redirect to be both
internal, and client-side -- after the internal redirect to generate the
response, the redirect itself should still happen on the client in the full
window). In that case, we'd need a separate argument to specify "internal"
independently (i.e., internal=True, client_side=True), so the client-side
specification might as well just be a boolean. Thoughts?
Anthony
--