Download Douglas Documentation

Transcript
Douglas Documentation, Release 0.1
Parameters
• extensions – the list of extensions to test
• filepath – the complete file path (minus the extension) to test and find the extension for
Returns the extension (string) of the file or None.
5.4.5 douglas.renderers.base
The is the base renderer module. If you were to dislike the blosxom renderer and wanted to build a renderer that used
a different templating system, you would extend the RendererBase class and implement the functionality required by
the other rendering system.
For examples, look at the BlosxomRenderer and the Renderer in the debug module.
class douglas.renderers.base.Renderer(request, stdoutput=<open file ‘<stdout>’, mode ‘w’>)
This is a null renderer.
class douglas.renderers.base.RendererBase(request, stdoutput=<open file ‘<stdout>’, mode
‘w’>)
Douglas core handles the Input and Process of the system and passes the result of the process to the Renderers
for output. All renderers are child classes of RendererBase. RenderBase will contain the public interfaces for
all Renderer onject.
add_header(*args)
Populates the HTTP header with lines of text
Parameters args – Paired list of headers
Raises ValueError This happens when the parameters are not correct
get_content()
Return the content field
This is exposed for blosxom callbacks.
Returns content
render(render_headers=True)
Do final rendering.
Parameters render_headers – whether (True) or not (False) to render the headers
set_content(content)
Sets the content. The content can be any of the following:
•dict
•list of entries
Parameters content – the content to be displayed
show_headers()
Updated the headers of the Response<douglas.douglas.Response> instance.
This is here for backwards compatibility.
write(data)
Convenience method for programs to use instead of accessing self._out.write()
Other classes can override this if there is a unique way to write out data, for example, a two stream output,
e.g. one output stream and one output log stream.
5.4. Code Documentation
65