Package dap :: Package responses :: Package html :: Module templess :: Class cgitemplate
[hide private]
[frames] | no frames]

Class cgitemplate

source code

simple cgi engine for serving templess templates

Instance Methods [hide private]
  __init__(self, template, content_type='text/html; charset=UTF-8', error_template='templates/cgierror.html', headers={})
  render(self, context)
render and output the document
  handle_exception(self, exc, e, tb)
internal method that generates and prints an exception page
  print_output(self, content_type, body)
actually print the output

Method Details [hide private]

__init__(self, template, content_type='text/html; charset=UTF-8', error_template='templates/cgierror.html', headers={})
(Constructor)

source code 
None

render(self, context)

source code 

render and output the document

this also prints the Content-Type header, if you want it to print other headers use the headers arg of the constructor

handle_exception(self, exc, e, tb)

source code 
internal method that generates and prints an exception page

print_output(self, content_type, body)

source code 
actually print the output