|
|||||||
1. Introduction
2. Installing Karrigell 3. The Web server 4. Working with Apache or Xitami 5. Programming 6. Debugging 7. Python scripts 8. Karrigell Services 8.1 Syntax 8.2 Smart urls 9. Python Inside HTML 10. HTML Inside Python 11. HTMLTags - generate HTML in Python 12. Including documents 13. Sessions 14. Authentication 15. Internationalization |
8. Karrigell Services8.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 :
8.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 :
|