Logo Search packages:      
Sourcecode: karrigell version File versions  Download package

KarrigellRequestHandler Namespace Reference


Detailed Description

Karrigell, a web programming framework in Python

Written by Pierre Quentel quentel.pierre@wanadoo.fr

Published under the GPL licence - no warranty, used at user's risk etc. See
http://www.gnu.org/copyleft/gpl.html and the file LICENCE.txt

Request handler built upon SimpleHTTPRequestHandler, except for the following
extensions :
- .py : executes the Python file in the global namespace ; sys.stdout is
redirected for writing on the HTTP output stream
- .pih : Python Inside HTML (see the PythonInsideHTML module for syntax) :
files mixing HTML and Python code, like PHP, ASP or JSP. The .pih file is
first translated into Python code, then this script is run
- .hip : HTML Inside Python : see the HIP module
- .ks : Karrigell Service (a service with different pages in one Python script)

Python programs run in a namespace including the following variables :
- QUERY : an dictionnary made out of the Query string (GET requests) or
from the request body (POST requests). The keys are the names of the form
items and the values are the item's value, as a string or as a list if the
field name ends with [] : for an <input type="text" name="info"> form item
you get the value in QUERY["info"] as a string ; for
<select multiple name="foo[]"> QUERY["foo"] will be a list
- the same form field QUERY["info"] is also available with the
shortcut _info (underscore + field name)
- HEADERS : dictionnary with the HTTP headers sent by the client
- RESPONSE : dictionnary with the HTTP headers to send in the response
- SET_COOKIE : a SimpleCookie objet (in Python Lib's Cookie module) used in
the response if set
- AUTH_USER, AUTH_PASSWORD : user identifier and password submitted in the
Authorization header if it's provided, None and None if not
- ACCEPTED_LANGUAGES : a list of languages accepted by user (accept-language
header field) ordered by preference
- REQUEST_HANDLER : the current instance of KarrigellRequestHandler
- THIS : the current instance of the Script class (see Template.py)

Python programs can also raise exceptions handled by the Karrigell
engine :
- SCRIPT_END : to terminate a script (added for readability reasons in the
.pih and .hip scripts, see examples)
- HTTP_REDIRECTION : raise HTTP_REDIRECTION,url causes the server to redirect
the client towards the given url

Session management by cookies is supported :
- in a script, a call to the Session() function returns a session object :
sessionObject=Session()
- you can then set and read attributes of this object :
    sessionObject.name=name
    name=sessionObject.name
- to end the session : sessionObject.close() erases the cookie

A maximum of 1000 simultaneous sessions is supported


Classes

class  AUTH_ABORT
class  HTTP_ERROR
class  HTTP_REDIRECTION
class  KarrigellRequestHandler
class  ReloadError

Variables

string __version__ = "2.2.1"
 gzip_support = False
tuple initial_path = copy.copy(sys.path)
tuple initialModules = copy.copy(sys.modules.keys())


Generated by  Doxygen 1.6.0   Back to index