Skip to content

Commit 220fd93

Browse files
committed
doc: Reverse engineer extension handling and add separate chapter
for them
1 parent 9e04626 commit 220fd93

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

doc/customizing.txt

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Customisation of Roundup can take one of six forms:
2222
1. `tracker configuration`_ changes
2323
2. database, or `tracker schema`_ changes
2424
3. "definition" class `database content`_ changes
25-
4. behavioural changes, through detectors_
25+
4. behavioural changes, through detectors_ and extensions_
2626
5. `security / access controls`_
2727
6. change the `web interface`_
2828

@@ -48,7 +48,7 @@ db/ Holds the tracker's database
4848
db/files/ Holds the tracker's upload files and messages
4949
db/backend_name Names the database back-end for the tracker
5050
detectors/ Auditors and reactors for this tracker
51-
extensions/ Additional web actions and templating utilities.
51+
extensions/ Additional actions and `templating utilities`_
5252
html/ Web interface templates, images and style sheets
5353
lib/ optional common imports for detectors and extensions
5454
=================== ========================================================
@@ -941,6 +941,33 @@ is not required - this is referred to as a "System Message" because it
941941
comes from "the system" and not a user).
942942

943943

944+
Extensions - adding capabilities to your tracker
945+
================================================
946+
.. _extensions:
947+
948+
While detectors_ add new behavior by reacting to changes in tracked
949+
objects, `extensions` add new actions and utilities to Roundup, which
950+
are mostly used to enhance web interface.
951+
952+
You can create an extension by creating Python file in your tracker
953+
``extensions`` directory. All files from this dir are loaded when
954+
tracker instance is created, at which point it calls ``init(instance)``
955+
from each file supplying itself as a first argument.
956+
957+
Note that at this point web interface is not loaded, but extensions still
958+
can register actions for in tracker instance. This may be fixed in
959+
Roundup 1.6 by introducing ``init_web(client)`` callback or a more
960+
flexible extension point mechanism.
961+
962+
963+
* ``instance.registerUtil`` is used for adding `templating utilities`_
964+
(see `adding a time log to your issues`_ for an example)
965+
966+
* ``instance.registerAction`` is used to add more actions to instance
967+
and to web interface. See `Defining new web actions`_ for details.
968+
Generic action can be added by inheriting from ``action.Action``
969+
instead of ``cgi.action.Action``.
970+
944971
Database Content
945972
================
946973

@@ -2528,10 +2555,11 @@ Roman Same as roman(), except uppercase.
25282555

25292556
The utils variable
25302557
~~~~~~~~~~~~~~~~~~
2558+
.. _templating utilities:
25312559

25322560
This is implemented by the
2533-
``roundup.cgi.templating.TemplatingUtils`` class, but it may be extended
2534-
as described below.
2561+
``roundup.cgi.templating.TemplatingUtils`` class, which may be extended
2562+
with additional methods by extensions_.
25352563

25362564
=============== ========================================================
25372565
Method Description
@@ -2544,11 +2572,6 @@ html_calendar renders an HTML calendar used by the
25442572
the popupCalendar DateHTMLProperty method
25452573
=============== ========================================================
25462574

2547-
You may add additional utility methods by writing them in your tracker
2548-
``extensions`` directory and registering them with the templating system
2549-
using ``instance.registerUtil`` (see `adding a time log to your issues`_ for
2550-
an example of this).
2551-
25522575

25532576
Batching
25542577
::::::::

0 commit comments

Comments
 (0)