Package trac :: Package versioncontrol :: Package web_ui :: Module browser :: Class IPropertyRenderer

Class IPropertyRenderer

source code

    object --+    
             |    
core.Interface --+
                 |
                IPropertyRenderer

Render node properties in TracBrowser and TracChangeset views.
Instance Methods
 
match_property(name, mode)
Indicate whether this renderer can treat the given property
source code
 
render_property(name, mode, context, props)
Render the given property.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

match_property(name, mode)

source code 

Indicate whether this renderer can treat the given property

mode is the current rendering context, which can be:
  • 'browser' rendered in the browser view
  • 'changeset' rendered in the changeset view as a node property
  • 'revprop' rendered in the changeset view as a revision property

Other identifiers might be used by plugins, so it's advised to simply ignore unknown modes.

Returns a quality number, ranging from 0 (unsupported) to 9 (''perfect'' match).

render_property(name, mode, context, props)

source code 

Render the given property.

name is the property name as given to match(), mode is the same as for match_property, context is the context for the node being render (useful when the rendering depends on the node kind) and props is the collection of the corresponding properties (i.e. the node.get_properties()).

The rendered result can be one of the following:
  • None: the property will be skipped
  • an unicode value: the property will be displayed as text
  • a RenderedProperty instance: the property will only be displayed using the instance's content attribute, and the other attributes will also be used in some display contexts (like revprop)
  • Markup or other Genshi content: the property will be displayed normally, using that content as a block-level markup