| 1 | --- api.py 2006-06-01 22:01:26.000000000 +0000 |
|---|
| 2 | +++ api.py.orig 2006-06-01 21:59:10.000000000 +0000 |
|---|
| 3 | @@ -458,10 +458,3 @@ |
|---|
| 4 | Note that if template processing should not occur, this method can |
|---|
| 5 | simply send the response itself and not return anything. |
|---|
| 6 | """ |
|---|
| 7 | - |
|---|
| 8 | -class IFallbackHandler(Interface): |
|---|
| 9 | - """Extension point interface for fallback handlers.""" |
|---|
| 10 | - |
|---|
| 11 | - def process_request(req): |
|---|
| 12 | - """Process the request. The handler should not return, either by raising |
|---|
| 13 | - an exception, or by redirecting the request elsewhere.""" |
|---|
| 14 | --- main.py 2006-06-01 22:24:29.000000000 +0000 |
|---|
| 15 | +++ main.py.orig 2006-06-01 21:46:02.000000000 +0000 |
|---|
| 16 | @@ -116,29 +116,8 @@ |
|---|
| 17 | elif isinstance(req.args[arg], basestring): |
|---|
| 18 | hdf['args.%s' % arg] = req.args[arg] |
|---|
| 19 | # others are file uploads |
|---|
| 20 | - |
|---|
| 21 | -class FallbackModule(Component): |
|---|
| 22 | - """The default fallback policy.""" |
|---|
| 23 | - |
|---|
| 24 | - implements(IFallbackHandler) |
|---|
| 25 | |
|---|
| 26 | - def process_request(self, req): |
|---|
| 27 | - raise HTTPNotFound('No handler matched request to %s', req.path_info) |
|---|
| 28 | - |
|---|
| 29 | -class WikiFallbackModule(Component): |
|---|
| 30 | - """A fallback policy that redirects to a wiki page if one exists.""" |
|---|
| 31 | - |
|---|
| 32 | - implements(IFallbackHandler) |
|---|
| 33 | - |
|---|
| 34 | - def process_request(self, req): |
|---|
| 35 | - from trac.wiki.model import WikiPage |
|---|
| 36 | - name = req.path_info.lstrip('/') |
|---|
| 37 | - page = WikiPage(self.env, name) |
|---|
| 38 | - if page.exists: |
|---|
| 39 | - req.redirect(req.href.wiki(name)) |
|---|
| 40 | - else: |
|---|
| 41 | - raise HTTPNotFound('No handler matched request to %s', req.path_info) |
|---|
| 42 | - |
|---|
| 43 | + |
|---|
| 44 | class RequestDispatcher(Component): |
|---|
| 45 | """Component responsible for dispatching requests to registered handlers.""" |
|---|
| 46 | |
|---|
| 47 | @@ -151,10 +130,6 @@ |
|---|
| 48 | |
|---|
| 49 | Options include `TimeLineModule`, `RoadmapModule`, `BrowserModule`, |
|---|
| 50 | `QueryModule`, `ReportModule` and `NewticketModule` (''since 0.9'').""") |
|---|
| 51 | - |
|---|
| 52 | - fallback_handler = ExtensionOption('trac', 'fallback_handler', |
|---|
| 53 | - IFallbackHandler, 'FallbackModule', |
|---|
| 54 | - """Name of the component that handles requests to non-existant handlers.""") |
|---|
| 55 | |
|---|
| 56 | # Public API |
|---|
| 57 | |
|---|
| 58 | @@ -188,8 +163,8 @@ |
|---|
| 59 | break |
|---|
| 60 | |
|---|
| 61 | if not chosen_handler: |
|---|
| 62 | - #raise HTTPNotFound('No handler matched request to %s', req.path_info) |
|---|
| 63 | - self.fallback_handler.process_request(req) |
|---|
| 64 | + raise HTTPNotFound('No handler matched request to %s', |
|---|
| 65 | + req.path_info) |
|---|
| 66 | |
|---|
| 67 | # Attach user information to the request |
|---|
| 68 | anonymous_request = getattr(chosen_handler, 'anonymous_request', False) |
|---|