[mod_python] Log is full with redirection messages...

Graham Dumpleton graham.dumpleton at gmail.com
Tue Mar 31 05:52:03 EDT 2009

2009/3/31 Durumdara <durumdara at gmail.com>:
> Hi!
> Please suggest me some tips, how to avoid this effect.
> I have a "shop" that have "items".
> When item purchased without problems, I redirect the user to the page to
> avoid F5/Refresh effect and to show some "success" message.
> When some item not existing, I redirect the user to the page "Does not
> exists!".
> I do this with:
>    util.redirect(R.Request, './page.ptml', 1)

The second argument to util.redirect() must be a proper URL, inclusive
of 'http://host' to work properly. Some browsers may work if absolute
path for same site, but not guaranteed. Definitely should not be a
relative path.

So, use an absolute URL path and pass it through req.construct_url()
to have appropriate 'http://host' added at the front.

  util.redirect(R.Request, req.construct_url('/some/absolute/url/page.ptml'), 1)


> Because of this, the error log is full with "non-error" elements, and it is
> hard to find the real errors.
> The web spiders uses caches, and steps to many items that "vanished now", so
> my is log is 95% of redir messages.
> Please help me a little: how to redirect them without error messages, and
> how to make 404 or other error without see the silent exception in the log?
> Thanks for your help:
>    dd
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list