7.2 ExecuteMixin Class
Description: ExecuteMixin Class
Keywords: albatross

#
7.2 ExecuteMixin Class

Albatross only supplies one class for this function; the `ExecuteMixin` class. This mixin provides a ``virtual machine'' which is used to execute HTML template files.

All standard Albatross execution context classes inherit from this class.

`__init__`( | )

  When you inherit from the `ExecuteMixin` class you must call this constructor to initialise the internal variables.

`get_macro_arg`( | name)

  Retrieves a macro argument from the macro execution stack. The stack is searched from the most recently pushed dictionary for an argument keyed by name. If no argument is found a `MacroError` exception is raised.

`push_macro_args`( | dict)

  Pushes a dictionary of macro arguments onto the macro execution stack.

`pop_macro_args`( | )

  Pops the most recently pushed dictionary of macro arguments from the macro execution stack.

`push_content_trap`( | )

  Saves accumulated content on the trap stack and then resets the content list.

`pop_content_trap`( | )

  Joins all parts on the content list and returns the result. Sets the content list to the value popped off the trap stack.

  The content trap is useful for performing out-of-order execution of template text. The `<al-option>` tag makes use of the content trap.

`write_content`( | data)

  Appends the content in data to the content list.

`flush_content`( | )

  Does nothing if a content trap stack is in effect, otherwise it joins all parts in the content list and sends it to the browser via the `send_content()` method. The content list is then reset via the `reset_content()` method.

`flush_html`( | )

  This is an alias for `flush_content()`.

`send_content`( | data)

  Sends the content passed in the data argument to standard output. This is overridden in the `AppContext` class to redirect data to the `write_content()` method of the application referenced in the `app` member.

`reset_content`( | )

  Sets the content list to an empty list and clears the content trap stack.