Version 2.4.0 12 04 08 Français

18. Karrigell namespace

This page lists all the names available in Karrigell scripts

ACCEPTED_LANGUAGES The list of languages accepted by the client (they can be set in the browser)
AUTH_USER User name if basic HTTP authentication is used
AUTH_PASSWORD User password if basic HTTP authentication is used
Authentication Function used for basic HTTP Authentication
CONFIG Configuration options, as set in the command line or in the configuration file

Attributes
serverDir Directory where the Karrigell.py script stands
rootDir Root directory, from where files and scripts are served
outputEncoding The encoding used for output

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
HTTP_REDIRECTION raise HTTP_REDIRECTION,url performs an HTTP redirection (302) to the specified url
Include() Function used to include a file or a script in another script
Login([script_url],[role=list_of_roles], [path=redirect_after_login]) Function user to limit access to the script to authenticated users. By default, if user is not yet logged in, redirects to the script login.ks in the root directory. Another script url can be specified to customize the authentication test. If 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
path is the path the user will be sent to after a successful login. It defaults to the path of the original script
PATH Script path
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

client_address A tuple with client IP address and port, for example ('127.0.0.1', 1825)
command The HTTP command or method (usually GET or POST)
encoding The encoding as returned by function guess_type in built-in module mimetypes

RESPONSE The response headers sent by the server to the client, such as Content-type
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"
SCRIPT_END Exception to stop the script execution
SCRIPT_ERROR raise SCRIPT_ERROR,msg to stop the execution of script and write msg
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
THIS An object representing the current script. The examples suppose that the script path in the filesystem is C:\cygwin\home\Karrigell\webapps\demo, and that it is called by the url demo/thisTest.pih

Attributes

basename Script base name (thisTest.pih)
baseurl Part of the url before the script name (demo/)
code The script source code (or the conversion into Python code for pih scripts)
dirname Directory name (C:\cygwin\home\Karrigell\webapps\demo)
extension Script extention (pih)
name Full name of the script in the file system (C:\cygwin\home\Karrigell\webapps\demo\thisTest.pih)
parent The script's parent if it was included by the Include() function, or None
path The path used by the client to request the script , including the query string if there was one (/demo/thisTest.pih)
rel() A function used to build correct urls inside functions that receive their arguments with the "smart url" feature (host/script/script.ks/foo/bar)
subpath If the script is requested with additional arguments separated by /, subpath is the list of these argements (see "smart urls")
url The url used to request the script, stripped from the query string if there was one (/demo/thisTest.pih)