make app "error" with a controller default.py and an action
def index():
from gluon.tools import Mail
mail=Mail()
mail.settings.server="smpt.example.com:port"
mail.settings.sender="[email protected]"
mail.settings.login="you:password"
ticket=request.vars.ticket
subject="Ticket: %s" % ticket
message=bla bla bla
mail.sent
(to="[email protected]",subject=subject,message=message)
return "Sorry, an error occurred (%s), administrator has been
notified" % ticket
and then create a file web2py/routes.py and in it write:
error_handler = dict(application='error', controller='default',
function='index')
On Sep 10, 8:54 am, David Zejda <[email protected]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello,
>
> for a productive site I wish to touch the default error handler, maybe
> using some kind of decorator. IMO it would be good to
>
> 1. retain the ticket generation
> 2. notify admin by e-mail
> 3. redirect client to a custom error page
>
> I would like to do it site-wide - not using the decorators for all
> controller functions one-by-one.
>
> Please, I will appreciate your advices..
>
> Thanks a lot!
>
> David
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org
>
> iEYEARECAAYFAkqpBQ8ACgkQ3oCkkciamVEWpwCglAV9jvlB7qNYeqzBHe6kyj5a
> Z94AoKhys1cmmSRw9UYAnzIdIX3E57aU
> =/pZf
> -----END PGP SIGNATURE-----
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---