The Application class is the base class for all Albatross application objects.
The class inherits from the ResourceMixin class to allow all application resources to be loaded once and used for every browser request. The AppContext class directs all resource related execution context method here.
The methods available in Application and the location of their definition are show below.
Method | Mixin |
---|---|
base_url() | Application |
format_exception() | Application |
get_lookup(name) | ResourceMixin |
get_macro(name) | ResourceMixin |
get_tagclass(name) | ResourceMixin |
handle_exception(ctx, req) | Application |
load_session(ctx) | Application |
merge_request(ctx) | Application |
pickle_sign(text) | Application |
pickle_unsign(text) | Application |
register_lookup(name, lookup) | ResourceMixin |
register_macro(name, macro) | ResourceMixin |
register_tagclasses(*tags) | ResourceMixin |
remove_session(ctx) | Application |
run(req) | Application |
save_session(ctx) | Application |
template_traceback(tb) | Application |
validate_request(ctx) | Application |
The Application class introduces a number of new methods.
base_url) |
The base_url argument is used as the base for URLs produced by the <al-a> and <al-form> tags.
) |
req) |
If an exception is caught then the handle_exception() method is called passing the req argument.
) |
sys.exc_info()
then
formats and returns the standard Python traceback and a template
interpreter traceback.
ctx, req) |
The method calls the format_exception() method to construct a standard Python traceback and a template traceback. A temporary execution context is then created, the Python traceback is saved in the locals.python_exc value, and the template traceback in the locals.html_exc value.
The method then tries to load the 'traceback.html' template file and execute it with the temporary execution context. This gives you the ability to control the presentation and reporting of exceptions.
If any exceptions are raised during the execution of 'traceback.html' the method writes both formatted exceptions as a <pre> formatted browser response.
tb) |
ctx) |
ctx) |
ctx) |
ctx) |
TRUE
.
You should override this method in your application object if you need to validate browser requests before processing them.
text) |
text) |
ctx) |