Ohloh Widgets Macro

 Ohloh has some nice  widgets which you can put on your site to show some statistics about your project. This software is about a  trac macro to make embedding these widgets in your trac wiki easy and does not force you to lower trac's security settings. Also this macro has a special API so you can modify any Ohloh widget so it blends in better with your layout.

The whole code is licensed under the very liberal  MIT license so you can use it in your own code without problems.


Display a single widget by specifying your project id and the widget name (the Javascript file name without the '.js' suffix):

[[OhlohWidget(483602, project_basic_stats)]]

Also you can display a group of widgets together:

[[OhlohWidgetGroup(483602, project_basic_stats, project_factoids, project_users?style=green)]]

This has the advantage that all widgets are grouped in a div so you can style it easily. For example the widget list on the left side of this page is a widget group with some custom

Download and Configuration

Enable the macro in your trac.ini:

ohloh_widgets.macro = enabled
# if you want to have better display of certain macros, enable also widget modificators:
ohloh_widgets.* = enabled

Dependencies and Compatibility

Customizing Widgets

Some  Ohloh widgets do not look nice on a trac page because some elements do not respect trac's layout (e.g. they use different colors for links). This macro already ships some modifiers which can change the appearance of some Ohloh macros with Javascript (jQuery) and CSS but you can easily add your own by writing a small plugin which implements this interface:

# This class is in ohloh_widgets.api
class IOhlohWidgetModifier(Interface):
    def widget_name(self):
        """Return the name of the widget which this modifier can modify.
        The widget name is the name of the JS file (e.g. 'project_factoids.js')
        without the '.js' suffix (=> 'project_factoids').
    def widget_fix(self):
        """Return a Genshi tag which is inserted directly after the widget's script 
        tag. Use this to add custom CSS/Javascript which whips the widget into shape


  • So far I did not bother setting up a support mailing list, just send an  email if you have questions.
  • If you found a bug, please file a bug.

If you like this software, please do me a favor and  vote on Ohloh and/or click the 'I use it' button on right.