Skipole WSGI generator.

Topics:

Introduction Getting Started Your Code start_call submit_data end_call skicall skicall.page_data

Tests at PythonAnywhere:

Widgets

Development at Bitbucket:

Skipole Project Documentation Downloads

skicall

The skicall object passed to your functions has several attributes, most provide you with information - some you can alter:

skicall.accesstextblocks is the project instance of the AccessTextBlocks class, most users will not need this, but it may be required for certain applications.

skicall.call_data is a dictionary which could contain data you set into it or could contain submitted form data (depending on the Responder handling the call).

skicall.caller_ident is the ident of the page making the call, a tuple ('projname', pagenumber), generally sent with any submitted data, this value could be an empty tuple if the page ident is not known - which will happen if the calling page is external or if no data is submitted.

skicall.environ is the wsgi environ dictionary.

skicall.ident_data is a string which was previously saved onto the page making the call by setting skicall.page_data['ident_data'], and has now been sent back together with any submitted data.
This facility can therefore be used to pass a reference identifier between calls. You need to validate this string here as it can be altered by a malicious caller. ident_data will be None if not present.

skicall.ident_list is initially an empty list but will have the ident ('projname', pagenumber) of each responder handling the call appended to it. Typically a call will be handled by a single responder, but it is possible for one responder to pass the call on to another, and so several may be involved in a call.

skicall.lang is a read-only tuple of two strings containing the preferred language required by the client in the format (language, default_language).
This attribute is used when requesting TextBlocks.

skicall.language is a string such as 'en' being the preferred language required by the client, initially taken from the client browser's language setting, or from a received language cookie. If changed it will cause a language cookie to be set. It may be that the client browser preferred language is not available, hence this is independent of the skicall.page_data['lang'] setting - which, if used, sets the page html tag 'lang' attribute.

skicall.page_data is a dictionary to be populated by your functions during the progress of this call.
It consists of a dictionary of {widgfields:values,...} which will be set in the final template page.

Note: a widgfield is a tuple ('widgetname', 'fieldname'), or a tuple ('sectionalias','widgetname', 'fieldname') if the widget is part of a section.

skicall.path is the URL path to the page called.

skicall.proj_data is a project attribute, a dictionary set when creating the skipole.WSGIApplication object. It could be used for your own purpose - for example to input a database password when the program is started.

skicall.project is the project name.

skicall.projectfiles is the string path to the 'projectfiles' directory of data and static files. Each project's specific directory can be found beneath it - that is, in the '..projectfiles/myproject/' directory.

skicall.received_cookies is a dictionary of cookie name:values received from the client. Note, that if skicall.language is set, a cookie value received will appear in this dictionary with key 'language'.

skicall.rootproject will be True if this is the root project, False if it is a sub project.

skicall.submit_list is a list set by a responder.

skicall.submit_dict is a dictionary set by a responder.

METHODS

skicall.label_value(label, project=None) is a method which given a label, returns the associated ident or URL.
If project is not given assumes the current project, if given, project must exist as either the root, or a sub project of the root. If no label is found, returns None.

skicall.textblock(textref, project=None) is a method which given a reference string returns the text of the associated TextBlock.
If project is None, it assumes the TextBlock is defined in the current project, if project is given it must be the root or a sub project. If no TextBlock is found, it returns None.

skicall.projectpaths() returns a dictionary of project names as keys with the project paths as values.