Mercurial > p > roundup > code
diff roundup/instance.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 | 6e9b9743de89 |
| children | 082ee3ded101 |
line wrap: on
line diff
--- a/roundup/instance.py Tue Nov 25 15:58:14 2014 +0300 +++ b/roundup/instance.py Tue Nov 25 17:29:38 2014 +0300 @@ -53,9 +53,11 @@ # for regression tests self.schema_hook = None self.config = configuration.CoreConfig(tracker_home) + self.actions = {} self.cgi_actions = {} self.templating_utils = {} + self.web_handlers = {} libdir = os.path.join(self.tracker_home, 'lib') self.libdir = os.path.isdir(libdir) and libdir or '' @@ -232,6 +234,14 @@ else: self.cgi_actions[name] = action + def registerHandler(self, urlpath, function): + """Add handler for urlpath. `urlpath` is a simple rule for + roundup.web.router that is matched before Roundup makes DB + lookups for classes that are available to render. + + New in version 1.6.x""" + self.web_handlers[urlpath] = function + def registerUtil(self, name, function): self.templating_utils[name] = function
