Hi I'm trying to implement a decorator for custom error pages in
web2py into sahanapy.
Ref - http://web2py.com/AlterEgo/default/show/75

I'm trying to keep it as a module in /modules directory so that I can
import it into the controllers and place the decorator appropriately.

I have kept error handling decorator as
/modules/onerror.py

and am importing it like this -
exec('from applications.%s.modules.onerror import onerror as onerror'
                                                        %
request.application)

HTTP object wasn't available in onerror.py so i did a -
from gluon.http import *

But then I readlized that the request object is also not available to
the decorator as in the line -
filename=os.path.join(request.folder,'views/errors/error
%i.html'%status)

I have some doubts -

1. Are the modules in the /modules directory automatically loaded as a
new web2py instance is created? If so how can I access them?

2. Is there a way I can pass the request object to this decorator from
my controller? Hints are welcome.

My current onerror.py - http://paste.pocoo.org/show/186165/
The way I'm trying to use in a controller - http://paste.pocoo.org/show/186167/

Let me know if I'm doing it in an unobvious way.

Thanks,
Abhishek

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to