Mercurial > p > roundup > code
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 4942:ba1ec6d13e76 | 4943:7920d700e580 |
|---|---|
| 51 # if set, call schema_hook after executing schema.py will get | 51 # if set, call schema_hook after executing schema.py will get |
| 52 # same variables (in particular db) as schema.py main purpose is | 52 # same variables (in particular db) as schema.py main purpose is |
| 53 # for regression tests | 53 # for regression tests |
| 54 self.schema_hook = None | 54 self.schema_hook = None |
| 55 self.config = configuration.CoreConfig(tracker_home) | 55 self.config = configuration.CoreConfig(tracker_home) |
| 56 | |
| 56 self.actions = {} | 57 self.actions = {} |
| 57 self.cgi_actions = {} | 58 self.cgi_actions = {} |
| 58 self.templating_utils = {} | 59 self.templating_utils = {} |
| 60 self.web_handlers = {} | |
| 59 | 61 |
| 60 libdir = os.path.join(self.tracker_home, 'lib') | 62 libdir = os.path.join(self.tracker_home, 'lib') |
| 61 self.libdir = os.path.isdir(libdir) and libdir or '' | 63 self.libdir = os.path.isdir(libdir) and libdir or '' |
| 62 | 64 |
| 63 self.load_interfaces() | 65 self.load_interfaces() |
| 230 if issubclass(action, cgi_actions.Bridge): | 232 if issubclass(action, cgi_actions.Bridge): |
| 231 self.cgi_actions[name] = action | 233 self.cgi_actions[name] = action |
| 232 else: | 234 else: |
| 233 self.cgi_actions[name] = action | 235 self.cgi_actions[name] = action |
| 234 | 236 |
| 237 def registerHandler(self, urlpath, function): | |
| 238 """Add handler for urlpath. `urlpath` is a simple rule for | |
| 239 roundup.web.router that is matched before Roundup makes DB | |
| 240 lookups for classes that are available to render. | |
| 241 | |
| 242 New in version 1.6.x""" | |
| 243 self.web_handlers[urlpath] = function | |
| 244 | |
| 235 def registerUtil(self, name, function): | 245 def registerUtil(self, name, function): |
| 236 self.templating_utils[name] = function | 246 self.templating_utils[name] = function |
| 237 | 247 |
| 238 class TrackerError(Exception): | 248 class TrackerError(Exception): |
| 239 pass | 249 pass |
