Ticket #1855: preprocessor_r2165.patch
| File preprocessor_r2165.patch, 1.8 KB (added by Bruce Christensen <trac@…>, 7 years ago) |
|---|
-
trac/web/api.py
239 239 """ 240 240 241 241 242 class IRequestPreprocessor(Interface): 243 """Extension point interface for request preprocessors.""" 244 245 def preprocess_request(req): 246 """Preprocess the request. This allows any last-minute processing before 247 the request is dispatched to the request handler. 248 """ 249 250 242 251 def absolute_url(req, path=None): 243 252 """Reconstruct the absolute URL of the given request. 244 253 -
trac/web/main.py
23 23 from trac.perm import PermissionCache, PermissionError 24 24 from trac.util import escape, enum 25 25 from trac.web.api import absolute_url, Request, RequestDone, IAuthenticator, \ 26 IRequest Handler26 IRequestPreprocessor, IRequestHandler 27 27 from trac.web.chrome import Chrome 28 28 from trac.web.clearsilver import HDFWrapper 29 29 from trac.web.href import Href … … 59 59 """Component responsible for dispatching requests to registered handlers.""" 60 60 61 61 authenticators = ExtensionPoint(IAuthenticator) 62 preprocessors = ExtensionPoint(IRequestPreprocessor) 62 63 handlers = ExtensionPoint(IRequestHandler) 63 64 64 65 def authenticate(self, req): … … 99 100 100 101 chrome.populate_hdf(req, chosen_handler) 101 102 103 for preprocessor in self.preprocessors: 104 preprocessor.preprocess_request(req) 105 102 106 if not chosen_handler: 103 107 # FIXME: Should return '404 Not Found' to the client 104 108 raise TracError, 'No handler matched request to %s' % req.path_info
