|
|||||||
1. Introduction
2. Installing Karrigell 3. The Web server 4. Configuration options 5. Working with Apache, LightTPD or Xitami 6. Programming 7. Debugging 8. Python scripts 9. Karrigell Services 9.1 Syntax 9.2 Smart urls 10. Python Inside HTML 11. HTML Inside Python 12. HTMLTags - generate HTML in Python 13. Including documents 14. Sessions 15. Authentication 16. Translation and Unicode |
9. Karrigell Services9.1 Syntax"Karrigell Services" are Python scripts which can handle several URLs, so that a complete service with different HTML pages can be created with just one script To achieve this, the functions in a Karrigell service match a URL : the
function To call the method If no function is specified, Karrigell searches for a function called
Note that for security and readability reasons, only the functions explicitely defined in the ks script, and whose definition starts at the column 0 in the source code, can be called If you need to define functions inside the script but don't want them to be called by a url, prefix them by an underscore (_)
To "jump" from one function to another, just specify the function name in a link or a form action :
Notice the first line in the All the HTTP environment, form fields, custom exceptions, functions for authentication, session handling etc. are the same as in Python scripts Here is an example of a simple Karrigell Service :
9.2 Smart urlsFor some uses it may be useful to access Karrigell Services with urls that specify additional parameters. For instance, the urlhtpp://path/service.ks/function/foo/bar?name=smith
would call the function with 'foo' and 'bar' as parameters
They can be found in the script in an attribute of
A problem with these "smart urls" is that if you have to write a link, or use
This number is defined by the length of the
THIS called up :
|