trac.versioncontrol.web_ui.browser

class trac.versioncontrol.web_ui.browser.IPropertyRenderer

Bases: trac.core.Interface

Render node properties in TracBrowser and TracChangeset views.

match_property(mode)

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(mode, context, props)

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 Fragment: the property will be displayed normally, using that content as a block-level markup
class trac.versioncontrol.web_ui.browser.DefaultPropertyRenderer

Bases: trac.core.Component

Default version control property renderer.

class trac.versioncontrol.web_ui.browser.WikiPropertyRenderer

Bases: trac.core.Component

Wiki text property renderer.

wiki_properties

Comma-separated list of version control properties to render as wiki content in the repository browser.

oneliner_properties

Comma-separated list of version control properties to render as oneliner wiki content in the repository browser.

class trac.versioncontrol.web_ui.browser.BrowserModule

Bases: trac.core.Component

property_renderers

List of components that implement IPropertyRenderer

downloadable_paths

List of repository paths that can be downloaded.

Leave this option empty if you want to disable all downloads, otherwise set it to a comma-separated list of authorized paths (those paths are glob patterns, i.e. “*” can be used as a wild card). In a multi-repository environment, the path must be qualified with the repository name if the path does not point to the default repository (e.g. /reponame/trunk). Note that a simple prefix matching is performed on the paths, so aliases won’t get automatically resolved.

color_scale

Enable colorization of the ‘’age’’ column.

This uses the same color scale as the source code annotation: blue is older, red is newer.

newest_color

(r,g,b) color triple to use for the color corresponding to the newest color, for the color scale used in ‘’blame’’ or the browser ‘’age’’ column if color_scale is enabled.

oldest_color

(r,g,b) color triple to use for the color corresponding to the oldest color, for the color scale used in ‘’blame’’ or the browser ‘’age’’ column if color_scale is enabled.

intermediate_point

If set to a value between 0 and 1 (exclusive), this will be the point chosen to set the intermediate_color for interpolating the color value.

intermediate_color

(r,g,b) color triple to use for the color corresponding to the intermediate color, if two linear interpolations are used for the color scale (see intermediate_point). If not set, the intermediate color between oldest_color and newest_color will be used.

render_unsafe_content

Whether raw files should be rendered in the browser, or only made downloadable.

Pretty much any file may be interpreted as HTML by the browser, which allows a malicious user to create a file containing cross-site scripting attacks.

For open repositories where anyone can check-in a file, it is recommended to leave this option disabled.

hidden_properties

Comma-separated list of version control properties to hide from the repository browser.

get_custom_colorizer()

Returns a converter for values from [0.0, 1.0] to a RGB triple.

render_properties(mode, context, props)

Prepare rendering of a collection of properties.

render_property(name, mode, context, props)

Renders a node property to HTML.

TracBrowser link resolvers.

source: and browser:

Marks and anchor can be combined. The revision must be present when specifying line numbers. In the few cases where it would be redundant (e.g. for tags), the revision number itself can be omitted: /tags/v10/file@100-110#L99

get_annotation_data(context)

Cache the annotation data corresponding to each revision.

trac.versioncontrol.web_ui.browser.datetime_now()

[tz] -> new datetime with tz’s local day and time.