7.1 ResourceMixin Class

Albatross only supplies one class for this function; the ResourceMixin class. This mixin manages application resources which which do not change regardless of context. The resources managed are tag classes, HTML macros, and HTML lookup tables.

The SimpleContext execution context class subclasses the ResourceMixin class. During the constructor it registers all of the standard Albatross tags. As HTML templates are executed the macros and lookup tables in those templates are registered.

All standard Albatross application classes inherit from the Application class which in turn subclasses the ResourceMixin class. During the application class constructor all of the standard Albatross tags are registered. The AppContext class which is subclassed by all Albatross application execution context classes proxies all HTML macro and lookup table methods and directs them to the application object.

__init__( )
When you inherit from the ResourceMixin class you must call this constructor to initialise the internal variables.

get_macro( name)
Returns the macro previously registered by the name in the name argument. If no such macro exists None is returned.

register_macro( name, macro)
Registers the HTML macro in the macro argument under the name in the name argument.

get_lookup( name)
Returns the lookup table previously registered by the name in the name argument. If no such lookup exists None is returned.

register_lookup( name, lookup)
Registers the HTML lookup table in the lookup argument under the name in the name argument.

get_tagclass( name)
Returns the tag class in which the name member matches the name in the name argument. If no such tag class exists None is returned.

register_tagclasses( ...)
Registers one or more tag classes indexing them by the value in the name member of each class.