Package Pyblosxom :: Package renderers :: Module blosxom :: Class BlosxomRenderer
[show private | hide private]
[frames | no frames]

Class BlosxomRenderer

RendererBase --+
               |
              BlosxomRenderer

Known Subclasses:
Renderer

This is the default blosxom renderer. It tries to match the behavior of the blosxom renderer.
Method Summary
  __init__(self, request, stdoutput)
Constructor: Initializes the Renderer
  getContent(self)
Return the content field
  outputTemplate(self, output, entry, template_name, override)
Find the flavour template for template_name, run any blosxom callbacks, substitute entry into it and append the template to the output.
  render(self, header)
Figures out flavours and such and then renders the content according to which flavour we're using.
  _getFlavour(self, taste)
This retrieves all the template files for a given flavour taste.
  _outputFlavour(self, entry, template_name)
Find the flavour template for template_name, run any blosxom callbacks, substitute vars into it and write the template to the output
string _printTemplate(self, entry, template)
Return the content string
string _processContent(self)
Processes the content for the story portion of a page.
(string, string) _processEntry(self, entry, current_date)
Main workhorse of pyblosxom stories, comments and other miscelany goes here
  _run_callback(self, chain, input)
Makes calling blosxom callbacks a bit easier since they all have the same mechanics.
    Inherited from RendererBase
  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.
  setContent(self, content)
Sets the content
  showHeaders(self)
Updated the headers of the Response instance.
  write(self, data)
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)

Constructor: Initializes the Renderer
Parameters:
request - The Pyblosxom.pyblosxom.Request object
           (type=Pyblosxom.pyblosxom.Request object)
stdoutput - File like object to print to.
           (type=file)
Overrides:
Pyblosxom.renderers.base.RendererBase.__init__ (inherited documentation)

getContent(self)

Return the content field

This is exposed for blosxom callbacks.
Returns:
content

outputTemplate(self, output, entry, template_name, override=0)

Find the flavour template for template_name, run any blosxom callbacks, substitute entry into it and append the template to the output.

If the entry has a "template_name" property and override is 1 (this happens in the story template), then we'll use that template instead.
Parameters:
output - list of strings of the output
           (type=list)
entry - the entry to render with this flavour template
           (type=Pyblosxom.entries.base.EntryBase)
template_name - name of the flavour template to use
           (type=string)
override - whether (1) or not (0) this template can be overriden with the "template_name" property of the entry
           (type=boolean)

render(self, header=1)

Figures out flavours and such and then renders the content according to which flavour we're using.
Parameters:
header - whether (1) or not (0) to render the HTTP headers
           (type=boolean)
Overrides:
Pyblosxom.renderers.base.RendererBase.render

_getFlavour(self, taste='html')

This retrieves all the template files for a given flavour taste.
This will first pull the templates for the default flavour
of this taste if there are any.  Then it looks at EITHER
the configured datadir OR the flavourdir (if configured).  It'll
go through directories overriding the template files it has
already picked up descending the category path of the PyBlosxom
request.

For example, if the user requested the "html" flavour and is
looking at an entry in the category "dev/pyblosxom", then
_getFlavour will:

1. pick up the flavour files in the default html flavour
2. start in EITHER datadir OR flavourdir (if configured)
3. override the default html flavour files with html flavour
   files in this directory or in html.flav/ subdirectory
4. override the html flavour files it's picked up so far
   with html files in dev/ or dev/html.flav/
5. override the html flavour files it's picked up so far
   with html files in dev/pyblosxom/ or 
   dev/pyblosxom/html.flav/

If it doesn't find any flavour files at all, then it returns
None which indicates the flavour doesn't exist in this blog.

@param taste: the taste to retrieve flavour files for.
@type  taste: string

@returns: mapping of template name to template file data
@rtype: map

_outputFlavour(self, entry, template_name)

Find the flavour template for template_name, run any blosxom callbacks, substitute vars into it and write the template to the output
Parameters:
entry - the EntryBase object
           (type=Pyblosxom.entries.base.EntryBase)
template_name - - name of the flavour template
           (type=string)

_printTemplate(self, entry, template)

Parameters:
entry - either a dict or the Entry object
           (type=dict or Entry)
template - the template string
           (type=string)
Returns:
the content string
           (type=string)

_processContent(self)

Processes the content for the story portion of a page.
Returns:
the content string
           (type=string)

_processEntry(self, entry, current_date)

Main workhorse of pyblosxom stories, comments and other miscelany goes here
Parameters:
entry - either a dict or an Entry object
           (type=dict or Entry object)
current_date - the date of entries we're looking at @type string
Returns:
the output string and the new current date
           (type=(string, string))

_run_callback(self, chain, input)

Makes calling blosxom callbacks a bit easier since they all have the same mechanics. This function merely calls run_callback with the arguments given and a mappingfunc.

The mappingfunc copies the "template" value from the output to the input for the next function.

Refer to run_callback for more details.

Generated by Epydoc 2.1 on Tue Feb 7 21:43:58 2006 http://epydoc.sf.net