A quick tour of examples of Karrigell in action

hello.py
The Python script which prints the message "Hello Karrigell !"
hello1.py
The same, but with content-type set to "text/plain"
test.pih See source
A base test of a Python Inside HTML script, which prints HTTP headers, namespace, the list of modules available in this namespace, a computing of square
test.hip See source
A base test of HTML Inside Python script which prints HTTP headers, cookies, some calculation
ksTest.ks See source
A complete "Karrigell Service" in one script
counter.py Voir source
Counts the number of visits for a page
cheetahTest.py See source
For those who prefer templating systems, the popular Cheetah engine is included in the package. This script shows how to use it : create a Python script to define the variables, then use Include() and pass the variables in the script to the included template file cheetahTest.tmpl See source
globalTest.py
Uses a "global" module, called myScript, available in all scripts (this is specified in the configuration file)
myForm.htm See source
An HTML form sent to the Python script myScript.pySee source, which print entered values
fileUpload.html See source
An HTML form sent to the Python script fileUpload.pySee source, showing how to handle file uploads
includeDemo.py See source
A Python script which shows the use of the Include() function. The included script is footer.py See source which in turn includes includedFooter.py See source. The variable THIS changes for every script
htmlTagsTemplateTest.py See source
HTMLTags is a module to generate HTML from Python code. In this example I use it in a template module htmlTagsTemplate.py See source
This module uses the names clients and title, they are provided as keyword arguments in the function Include()
authenticationTest.pih See source
Shows how to use the authentication function, with a simple test function ; the values to enter are "holden" and "caulfield"
redirect.py See source
Redirection to another URL (in this particular case, my website about Breton songs...)
scriptErrorTest.pih See source
A script with a volontary error, to show how Karrigell prints error messages. The "Debug" button gives access to the debugger, which shows the script source code and allows to see the state of variables when the error occured. See also other errors
scriptEndTest.py See source
A script with a SCRIPT_END exception which allows script interruption before a line which causes an error
tabsDemo.pih See source
Shows a menu with horizontal tabs
sessionTestForm.htm See source
An HTML form whose data are stored using the session mechanism. Validating data causes a call to the script sessionTestBegin.pihSee source which initializes the session object from form fields. The following script, sessionTestFollow.pihSee sourceshows that data are indeed retrieved through this object
thisTest.pih See source
Shows the attributes of the object THIS
requestHandlerTest.pih See source
Shows the attributes of the object REQUEST_HANDLER
importTest.hip See source
This script only imports another one, importTest.pySee source and prints a value from this imported script. If the reload_modules option has been set to 1 in the initialization file (Karrigell.ini), when the value is changed in importTest.py (by editing the file in a text editor) then if you reload importTest.pih the value also changed. If reload_modules is not set, the change has no effect
This avoids having to restart the server every time an imported file is changed