ACF acf www-controller.lua reference: Difference between revisions

From Alpine Linux
Line 23: Line 23:


=== exception_handler ( self, message ) ===
=== exception_handler ( self, message ) ===
If ''message'' is a table, and message.type="redir" then issues a 302 Moved to the client, with the target of the redirect being ''message.prefix/message.controller/message.action message.extra''
If the message.type is "dispatch" then calls the parent (mvc.lua) exception handler.
Otherwise, calls the parent (mvc.lua) exception handler.
This function may be extended in the future (nba 26 Oct 2007)


=== view_resolver ( self ) ===
=== view_resolver ( self ) ===

Revision as of 20:12, 26 October 2007

acf_www-controller.lua reference

The acf_www-controller.lua provides the basic view resolver, exception handler, and application-wide functions for the acf web application.

cfe ( table )

Returns a table with value, type, option, errtxt and name values. If an input table is given in the call, those key/value pairs are added as well.

Guarantees the view will not get a "nil" on value, type, option, errtxt or name.

find_template (appdir, prefix, controller, action viewtype )

(internal function) Looks for a .lsp (Lua Server Page) template. Looks for the first matching:

  1. appdir/prefix/template-controller-action-viewtype.lsp
  2. appdir/prefix/template-controller-viewtype.lsp
  3. appdir/prefix/template-controller-action-viewtype.lsp
  4. appdir/prefix/template-action-viewtype.lsp
  5. appdir/prefix/template-viewtype.lsp

It repeats through each upper level of prefix until prefix is "nil". Returns the first found lsp, or false.

exception_handler ( self, message )

If message is a table, and message.type="redir" then issues a 302 Moved to the client, with the target of the redirect being message.prefix/message.controller/message.action message.extra

If the message.type is "dispatch" then calls the parent (mvc.lua) exception handler.

Otherwise, calls the parent (mvc.lua) exception handler.

This function may be extended in the future (nba 26 Oct 2007)

view_resolver ( self )