The Trac Plugin

Adjector provides a plugin for Trac 0.11 (and probably 0.10 too) that lets you render Adjector ads directly into Trac. The plugin uses the Adjector Client Library, so you don't need to have the full version of Adjector installed.

Currently the plugin only works for Genshi templates, but it would be trivial to get it to work in ClearSilver, I just don't have the desire to do it or ability to test it. But feel free to submit a patch?. : )

We use the trac plugin on this very page! Every ad you see is displayed using it.

Install

First, Download the plugin. Then, you can go to the plugin directory and run

python setup.py install

(or python.setup.py develop if you want to poke around in the code). This will install the plugin and any of its dependencies. The plugin can work with the stripped-down client-only Adjector or the full version; if you have neither it will install the client-only version.

(Autoinstall will only work once we've submitted Adjector to PyPI, if you are a very early visitor you might have to install it manually. Of course we'll forget to remove this message for about 3 years after it works...)

Enable

To enable the plugin, either go to Admin > Plugins in your trac's web interface and check the box, or add this line to your trac.ini in the [components] stanza (create one if it doesn't exist):

adjector.plugins.trac.* = enabled

Configure

You need to add some options to your trac.ini file, under an [adjector] stanza. An sqlalchemy.url and a base_url are a required, and a time zone (the zone at your trac server) is a good idea so your stats don't get messed up. For example:

[adjector]
base_url = http://path.to.my.server/BASE_URL
sqlalchemy.url = sqlite:///path/to/my/development.db
server_tz = US/Pacific 

You can just cut and paste most of the options from an .ini file that came with Adjector, but remember that the base_url should be an absolute url pointing to your Adjector server's base (including its base_url). More Options

Render Ads

Before you try to render an ad, RELOAD APACHE or whatever you are using to serve trac.

To render an ad, you just have to ad this to your trac template. This command has the same syntax as the client library's render_zone.

${render_zone(1)}
${render_zone('myzone', track=False, admin=True)}

The first argument is the name or id of your zone, the others are optional. The first command renders the zone with the id 1, the second renders the zone named 'myzone' with tracking disabled and admin mode enabled. More Information