8.10 The ModularApp Class
Description: The ModularApp Class
Keywords: albatross

#
8.10 The `ModularApp` Class

The `ModularApp` class is intended for use in applications which define page code in a collection of Python modules.

Figure: The `ModularApp` class

The methods available in `ModularApp` and the location of their definition are show below.

Method | Mixin
--- | ---
`base_url()` | `Application`
`create_context()` | `ModularApp`
`display_response(ctx)` | `PageModuleMixin`
`format_exception()` | `Application`
`get_lookup(name)` | `ResourceMixin`
`get_macro(name)` | `ResourceMixin`
`get_tagclass(name)` | `ResourceMixin`
`handle_exception(ctx, req)` | `Application`
`load_page(ctx)` | `PageModuleMixin`
`load_page_module(ctx, name)` | `PageModuleMixin`
`load_session(ctx)` | `Application`
`load_template(name)` | `CachingTemplateLoaderMixin`
`load_template_once(name)` | `CachingTemplateLoaderMixin`
`merge_request(ctx)` | `Application`
`module_path()` | `PageModuleMixin`
`page_enter(ctx, args)` | `PageModuleMixin`
`page_leave(ctx)` | `PageModuleMixin`
`pickle_sign(text)` | `PickleSignMixin`
`pickle_unsign(text)` | `PickleSignMixin`
`process_request(ctx)` | `PageModuleMixin`
`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`
`start_page()` | `PageModuleMixin`
`template_traceback(tb)` | `Application`
`validate_request(ctx)` | `Application`

The `ModularApp` class defines the following methods:

`__init__`( | base_url, module_path, template_path, start_page, secret)

  When you inherit from the `ModularApp` class you must call this constructor.

  The base_url argument is used as the base for URLs produced by the `<al-a>` and `<al-form>` tags. The module_path argument defines the root directory where page modules are loaded from. The template_path argument defines the root directory where template files are loaded from. The start_page identifies the first page that will be served up in a new browser session. The secret argument is used to MD5 sign all pickles sent to the browser.

`create_context`( | )

  Returns a new instance of the `SimpleAppContext` class.