Mercurial > p > roundup > code
diff plugins/extensions/custompage.py @ 4943:7920d700e580 routing
Add support for extensions to provide custom pages to Roundup
and update CHANGES.txt
1. Added registerHandler() extension point to instance.Tracker
to register URL handlers for specific routes
2. Added processing of extension routes to client.cgi
3. Added example plugins/extensions/custompage.py
| author | anatoly techtonik <techtonik@gmail.com> |
|---|---|
| date | Tue, 25 Nov 2014 17:29:38 +0300 |
| parents | |
| children | 8aac417c1899 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/extensions/custompage.py Tue Nov 25 17:29:38 2014 +0300 @@ -0,0 +1,26 @@ +# This Roundup extension was written by techtonik@gmail.com and it's been +# placed in the Public Domain. Copy and modify to your heart's content. + +""" +The extension demonstrates Roundup API for creating custom pages +for tracker. +""" + + +def render_html(): + """Page with static html.""" + return "I'm <b>glowing</b>." + +def render_version(): + """ + Page with some 'dynamic' content demonstrating that extension + doesn't may import Roundup to access its API, but doesn't need + to depend on it. + """ + import roundup + return "Roundup %s" % roundup.__version__ + + +def init(tracker): + tracker.registerHandler('/staticpage', render_html) + tracker.registerHandler('/version', render_version)
