Mercurial > p > roundup > code
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 4942:ba1ec6d13e76 | 4943:7920d700e580 |
|---|---|
| 1 # This Roundup extension was written by techtonik@gmail.com and it's been | |
| 2 # placed in the Public Domain. Copy and modify to your heart's content. | |
| 3 | |
| 4 """ | |
| 5 The extension demonstrates Roundup API for creating custom pages | |
| 6 for tracker. | |
| 7 """ | |
| 8 | |
| 9 | |
| 10 def render_html(): | |
| 11 """Page with static html.""" | |
| 12 return "I'm <b>glowing</b>." | |
| 13 | |
| 14 def render_version(): | |
| 15 """ | |
| 16 Page with some 'dynamic' content demonstrating that extension | |
| 17 doesn't may import Roundup to access its API, but doesn't need | |
| 18 to depend on it. | |
| 19 """ | |
| 20 import roundup | |
| 21 return "Roundup %s" % roundup.__version__ | |
| 22 | |
| 23 | |
| 24 def init(tracker): | |
| 25 tracker.registerHandler('/staticpage', render_html) | |
| 26 tracker.registerHandler('/version', render_version) |
