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

Class BlosxomRenderer

source code

base.RendererBase --+
                    |
                   BlosxomRenderer
Known Subclasses:
Renderer

This is the default blosxom renderer. It tries to match the behavior of the blosxom renderer.

Instance Methods [hide private]
 
__init__(self, request, stdoutput=sys.stderr)
Constructor: Initializes the Renderer
source code
map
_getflavour(self, taste='html')
This retrieves all the template files for a given flavour taste.
source code
string
_printTemplate(self, entry, template)
Returns: the content string
source code
(string, string)
_processEntry(self, entry, current_date)
Main workhorse of pyblosxom stories, comments and other miscelany goes here
source code
string
_processContent(self)
Processes the content for the story portion of a page.
source code
 
render(self, header=1)
Figures out flavours and such and then renders the content according to which flavour we're using.
source code
 
_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
source code
 
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.
source code
 
_run_callback(self, chain, input)
Makes calling blosxom callbacks a bit easier since they all have the same mechanics.
source code
 
getContent(self)
Return the content field
source code
    Inherited from base.RendererBase
 
addHeader(self, *args)
Populates the HTTP header with lines of text
source code
 
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.
source code
 
setContent(self, content)
Sets the content
source code
 
showHeaders(self)
Updated the headers of the Response instance.
source code
 
write(self, data)
Convenience method for programs to use instead of accessing self._out.write()
source code
Method Details [hide private]

__init__(self, request, stdoutput=sys.stderr)
(Constructor)

source code 
Constructor: Initializes the Renderer
Overrides: base.RendererBase.__init__
(inherited documentation)

_getflavour(self, taste='html')

source code 

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.
Parameters:
  • taste (string) - the taste to retrieve flavour files for.
Returns: map
mapping of template name to template file data

_printTemplate(self, entry, template)

source code 
Parameters:
  • entry (dict or Entry) - either a dict or the Entry object
  • template (string) - the template string
Returns: string
the content string

_processEntry(self, entry, current_date)

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

_processContent(self)

source code 
Processes the content for the story portion of a page.
Returns: string
the content string

render(self, header=1)

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

_outputFlavour(self, entry, template_name)

source code 
Find the flavour template for template_name, run any blosxom callbacks, substitute vars into it and write the template to the output
Parameters:

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

source code 

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) - list of strings of the output
  • entry (Pyblosxom.entries.base.EntryBase) - the entry to render with this flavour template
  • template_name (string) - name of the flavour template to use
  • override (boolean) - whether (1) or not (0) this template can be overriden with the "template_name" property of the entry

_run_callback(self, chain, input)

source code 

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.

getContent(self)

source code 

Return the content field

This is exposed for blosxom callbacks.
Returns:
content