9. Built-in names
This page lists all the names available in Karrigell scripts
9.1 Read-only values
ACCEPTED_LANGUAGES | The list of languages accepted by the client (they can be set in the browser) | ||||||||||||||||||||
CONFIG | Configuration options, as set in the
configuration file Attributes
|
||||||||||||||||||||
COOKIE | The cookies sent by the client to the server. Instance of the SimpleCookie class in Python cookie module | ||||||||||||||||||||
HEADERS | The request headers, sent by the user agent (browser) to the server. Instance
of the email.Message class |
||||||||||||||||||||
QUERY | When a script receives form data, QUERY is a dictionary mapping field names to field values | ||||||||||||||||||||
REQUEST | When a script receives form data, REQUEST is a dictionary mapping field names to field values (same as QUERY) | ||||||||||||||||||||
REQUEST_HANDLER | An object representing the current request handler
Attributes
| ||||||||||||||||||||
THIS | An object representing the current script. The examples suppose that the script
path in the filesystem is C:\cygwin\home\Karrigell\webapps\demo\thisTest.pih,
and that it is called by the url demo/thisTest.pih?arg1=value1
Attributes
|
9.2 Variables and functions
Include() | Function used to include a file or a script in another script |
Login([script_url],[role], [valid_in], [redir_to]) | Function used to limit access to the script to authenticated users.
By default, if the user is not yet logged in, redirects to the script
login.ks in the admin
directory. Another script url can be
specified to customize the authentication test. If the user is already logged
in, the function does nothing
role is the list of roles accepted by the script. It defaults
to ["admin"] and can include "edit" and
"visit" as other values
valid_in specifies the part of the site where the user will
be logged. Defaults to the scripts in the same folder as the calling script
redir_to is the path the user will be sent to after a successful
login. It defaults to the path of the original script
|
Logout([script_url], [valid_in], [redir_to]) | Logs out the user. The arguments have the same meaning as above |
REL() | A function to transform a relative path name to an absolute path name, based on the script directory |
RESPONSE | The response headers sent by the server to the client, such as Content-type.
Instance of the email.Message class |
Role() | Indicates the user role. If he is not yet logged in (see Login() ),
value is None ; otherwise it is one of "visit", "edit" or "admin"
|
Session() | Function that returns the session object |
SET_COOKIE | The Cookies sent by the server to the client. Instance of the SimpleCookie class in Python cookie module |
9.3 Exceptions
HTTP_REDIRECTION | raise HTTP_REDIRECTION,url performs an HTTP redirection (302) to the
specified url |
SCRIPT_END | Exception to stop the script execution |