MODULE neo_cgi

Clearsilver is contained in one neo_cgi.so shared library Python module. However, this one library actually contains three Python modules. Some "magic" is used to export "neo_util" and "neo_cs" into Python from the same library. Because of this trickery, you always need to import neo_cgi once first before you can import neo_util or neo_cs.

neo_cgi contains the Clearsilver CGI Kit functionality. It handles functions such as the HTTP form variable parsing, upload parsing, and http header generation. It also has a set of utility functions which are written in fast C-code for doing string escaping and conversion (since Python is slow as a dog).

cgiWrap(FILE:stdin,FILE:stdout,DICT:environ)
this causes the Clearsilver CGI kit to go THROUGH the python objects for input, output, etc. If you don't call this, then it'll use the low-level C standard in/out, etc. If you are going to use the Python standard out, then you want to tell Clearsilver to use it also to avoid buffering problems. It also is important if you are running as an apache module, or if your python code is grabbing the python stdout.
STRING:urlEscape(STRING:a_string)
space -> +, other things to %XX
STRING:urlUnescape(STRING:a_string)
+ -> space, %XX back to character
STRING:htmlEscape(STRING:a_string)
" to " and > to > and similar conversions
STRING:text2html(STRING:a_string)
Parses plain text and attempts to make it nicely turn into HTML. It tries to find paragraph boundaries and make them <p>, and turn URLs into links, etc.
IgnoreEmptyFormVars(INT:enable)
Causes form variables equal to the empty string not to be placed in the HDF dataset. For example:
/mycgi.py?foo=&bar=1
If you set this setting, foo will not appear in Query.foo, if you don't set this setting, it will appear as the empty string.
exportDate(HDF:dataset,STRING:hdf_path_prefix, STRING:timezone_name, INT:time_t)
Exports a time_t date value into HDF in a structured form so you can render it into a webpage later.
update()
This is only necessary in PyApache in non-single Python interpreter mode. If you are using an embedded Python interpreter which continues to be reloaded every page, then update reinstalls the "fake" modules neo_util, and neo_cs. This is necessary because on interpreter restart the modules are kept loaded, but their init functions are not re-run.
CGI_OBJECT:CGI()
This creates a CGI object, with it's embedded CS and HDF objects. This also parses the enviroment variables and thus the CGI form data present in those variables. It does NOT parse standard input for HTTP POST data. That happens when you call "parse" on the CGI_OBJECT