Nest application framework.
Object Nest
This object represents the core of the Nest system. It is mean to be part of the web application loading it, so it should be loaded with the directive
load nest
Properties | |
AL | Repeat the AuthLevel enumeration |
DM | Repeat data managers. An enumeration with the following values
|
PRIO | Repeat the Priority enumeration |
auth_level | For now, use the max authlevel by default. |
debug | Debug mode? |
extscripts | Javascripts to be loaded in html headers |
filter | Filter for input variables (POST or GET key/value pairs). |
frame | Framing. |
inputVars | Input variables as parsed and filtered. |
log_level | Log level. |
logger | Basic logger |
nest_dir | Home of the nest installed hierarcy. |
onStartup | Function called back after routing and before routed page execution. |
pid | Page ID of the currently served page |
router | Router. |
scripts | Inline scripts to be put before body. |
self_uri | URI of the entry point script. |
services | List of active services. |
sessionData | Nest-specific session data. |
sessionExpired | True when we detect the session data to be exipred. |
sessionManager | Manager for persistent variables. By default, it's pointing to a BasicSessionManager object, which implements the stanard WOPI session management. |
site_nest_dir | Nest application directory for current site. |
styles | Inline scripts to be put before body. |
stylesheets | Stylesheets to be loaded in html headers |
title | Title for the page. This will be renedered as |
Methods | |
ambient | Invoke an ambient variable. |
dm | Invoke a Data Manager. |
route | Nest entry point. |
selector | Page selector. |
service | Invoke a service. |
Repeat the AuthLevel enumeration
Repeat data managers. An enumeration with the following values
Repeat the Priority enumeration
For now, use the max authlevel by default.
Debug mode?
Javascripts to be loaded in html headers
Filter for input variables (POST or GET key/value pairs).
Filters the content of the get and post values and stores them in the Nest.inputVars field as a dictionary pairs.
Cookies and session data are used by Nest and provided to the application via the Nest.sessionData property. However, the application can access them separately (nest uses a "Nest" namespace to save its own variables in cookies or session data).
The filter object must expose a "filter" function, that returns the dictionar function should return a dictionary of variables then saved in the inputVars field.
The basic (default) filter just stores all the GET and POST variables in the inputVars field (post variables having higer priority).
Framing.
When the frame property is set to a function, then Nest will load the page that the routing system required and render it separately. The output of the rendered page will be retrieved through the Nest.content method; then, the function stored in frame will be called, and it will just need to print Nest.content variable at the desired position.
Interesting functions can be:
Nest.frame = .[ include "some_file" ] Nest.frame = .[ include Nest.pageLink("pid-of-frame") ]
The function should produce an output that will be captured by Nest and then rendered.
Input variables as parsed and filtered.
At the disposal of services and user applications.
Log level.
Can be:
Basic logger
Home of the nest installed hierarcy.
It defaults to vmModulePath(), which is the path from where Falcon loaded this Nest module.
Function called back after routing and before routed page execution.
This is the ideal place to put code that must be always executed.
Normally, database managers and login services are configured here.
Page ID of the currently served page
Router.
This object maps a raw web request into a page id.
The property can be assigned by the user application to an arbitrary router, which is an object exposing a route() function.
The function must return a page id (a string) if the router could determine where the request should be sent, or nil if the page ID cannot be determined.
In this case, Nest raises an error and the execution terminates.
The default router seeks a "pid" field first in the posts, then the gets fields of the Request. If the "pid" is not found, the router returns a "home" page id.
Inline scripts to be put before body.
URI of the entry point script.
If set to nil, in case of need the URI of the entry point script will be determined through the Request fields.
List of active services.
Usually not at the disposal of the user application.
Nest-specific session data.
Contains data which must be retained across sessions.
Services use it automatically, but it can be used also by the user application at will.
True when we detect the session data to be exipred.
Manager for persistent variables. By default, it's pointing to a BasicSessionManager object, which implements the stanard WOPI session management.
Nest application directory for current site.
It's relative to the entrypoint script, and defaults to "./nest".
Inline scripts to be put before body.
Stylesheets to be loaded in html headers
Title for the page. This will be renedered as
Invoke an ambient variable.
ambient( aname, binding )
Ambient variables are service variables which are immediately repeated to all the system.
Invoke a Data Manager.
dm( name, [config] )
name | The name of the data manager to be invoked. |
config | Dictionary of variables to be used as configuration. |
The "type" key must be specified either in the config parameter or in the file named after dm/
All the entities relative to this Data Manager name. For example, they are named like dm/
Nest entry point.
route()
This method routes a web request down into the nest sytem.
Page selector.
selector( pid )
Call this function to get the main ID of the page to be displayed.
This is the entry point of a Nest web application.
Invoke a service.
service( name, [inst],[vars] )
name | The logical name of the service to be invoked. |
inst | The instance name for the service. |
vars | A dictionary of configuration key/values pairs. |
Return | A Service instance. |