Ticket #3655: irequestfilter_patch_3689.2.diff
| File irequestfilter_patch_3689.2.diff, 2.1 KB (added by cboos, 2 years ago) |
|---|
-
trac/web/api.py
467 467 requests, before and/or after they are processed by the main handler.""" 468 468 469 469 def pre_process_request(req, handler): 470 """ Do any pre-processing the request might need; typically adding471 values to req.hdf, or redirecting.470 """Called after initial handler selection, and can be used to change 471 the selected handler or redirect request. 472 472 473 473 Always returns the request handler, even if unchanged. 474 474 """ 475 475 476 def prepare_request(req, handler): 477 """Do any pre-processing before actual processing; typically adding 478 values to req.hdf, req.environ or similar. 479 480 If no handler is found or the handler does not use templates, 481 req.hdf will be None. 482 483 Always returns the request object, even if unchanged. 484 """ 485 476 486 def post_process_request(req, template, content_type): 477 487 """Do any post-processing the request might need; typically adding 478 488 values to req.hdf, or changing template or mime type. -
trac/web/main.py
206 206 req.hdf = HDFWrapper(loadpaths=chrome.get_all_templates_dirs()) 207 207 populate_hdf(req.hdf, self.env, req) 208 208 chrome.populate_hdf(req, chosen_handler) 209 else: 210 req.hdf = None 209 211 except: 210 212 req.hdf = None # revert to sending plaintext error 211 213 if not early_error: … … 217 219 # Process the request and render the template 218 220 try: 219 221 try: 222 for f in self.filters: 223 req = f.prepare_request(req, chosen_handler) 224 220 225 resp = chosen_handler.process_request(req) 221 226 if resp: 222 227 for filter_ in reversed(self.filters):
