| Home | Trees | Index | Help |
|
|---|
| Package Pyblosxom :: Package renderers :: Module base :: Class RendererBase |
|
BlosxomRenderer,
Renderer,
Renderer| Method Summary | |
|---|---|
Constructor: Initializes the Renderer | |
Populates the HTTP header with lines of text | |
Use the renderer to determine 'Content-Type: x/x' default is to use the renderer for Content-Type, set flag to None to indicate no Content-Type generation. | |
Do final rendering. | |
Sets the content | |
Updated the headers of the Response instance. | |
Convenience method for programs to use instead of accessing self._out.write() | |
| Method Details |
|---|
__init__(self,
request,
stdoutput=<epydoc.imports._DevNull instance at 0x4021768c>)
Constructor: Initializes the Renderer
|
addHeader(self, *args)Populates the HTTP header with lines of text
|
needsContentType(self, flag)Use the renderer to determine 'Content-Type: x/x' default is to use the renderer for Content-Type, set flag to None to indicate no Content-Type generation.
|
render(self, header=1)Do final rendering.
|
setContent(self, content)Sets the content
|
showHeaders(self)Updated the headers of theResponse instance. This is just for
backwards compatibility.
|
write(self, 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. Another use for this could be a plugin that writes out binary files, but because renderers and other frameworks may probably not want you to write tostdout directly, this method assists you nicely.
For example:
def cb_start(args):
req = args['request']
renderer = req['renderer']
if reqIsGif and gifFileExists(theGifFile):
# Read the file
data = open(theGifFile).read()
# Modify header
renderer.addHeader('Content-type', 'image/gif')
renderer.addHeader('Content-Length', len(data))
renderer.showHeaders()
# Write to output
renderer.write(data)
# Tell pyblosxom not to render anymore as data is
# processed already
renderer.rendered = 1
This simple piece of pseudocode explains what you could do with this
method, though I highly don't recommend this, unless pyblosxom is
running continuously.
|
| Home | Trees | Index | Help |
|
|---|
| Generated by Epydoc 2.1 on Tue Feb 7 21:43:58 2006 | http://epydoc.sf.net |