Skipole WSGI generator.


Introduction Getting Started Your Code start_call submit_data end_call PageData SectionData skicall Serving wsgi

Development at GitHub:

start_call(called_ident, skicall)

The minimum version is:

    def start_call(called_ident, skicall):
        return called_ident

When a call is received by the server, this function is called.

called_ident is normally the ident of the page being called, it is a tuple ('myprojname', pagenumber) - with 'myprojname' being the project name, and pagenumber being the unique integer page number. If the ident of the called page cannot be determined (the path called does not relate to a page) then called_ident will be None.

skicall is the call object described here.

This function should normally return the called_ident value.

If any tests you set here, which could include testing received cookie values, are ok, then the function would normally return the called_ident given in the argument which is that of the page being called.

Possible return values which you may choose to use are:

If you wish to handle the call via another page, return an ident, ident number or label of a page to jump to. You could, for example, use this feature to direct the call to a log in page. A label is a string, optionally set in the admin session, which references a page ident or URL, used instead of page idents.

If the ident returned is that of a responder page, then depending on the responder, (or sequence of responders) further function calls may be made to the submit_data function, if not a responder (for example a template page) then the function end_call will be called next, and then the template page will be sent to the client.

If start_call returns None, the 'URL NOT FOUND' page will be automatically returned to the client.

If a string url is returned, then a redirector page will be sent to the client. A url would not normally be used to redirect to a page within the project, but could be used to redirect to an external site.

If a pathlib.Path object is returned, which contains the path to a local server file (not a url) - then that server file will be sent to the client. In this case, the submit_data and end_call functions will not be called. In this situation, your start_call function could optionally set values into a PageData object with attributes 'status', 'headers' - or if headers is not set, 'mimetype' and 'enable_cache'. These are optional, if not set then the mimetype will be guessed from the filename extension.

Also see the skicall.map_url_to_server() method, which can be used to map a url folder to a folder of static files.

No un-caught exception should be raised in this function - if any are, the Server error page will be displayed.