Commits

Olemis Lang committed 0899fe9

BH Trac [ refs #749 ] : Substitute attribute error by config error in request dispatching loop

Comments (0)

Files changed (2)

+t749/t749_r1571498_default_handler_error.diff

t749/t749_r1571498_default_handler_error.diff

+# HG changeset patch
+# Parent a82f7d379c32554b953e973a74bb8bfdad319477
+BH Trac [refs #749] : Handle default handler configuration error gracefully
+
+diff -r a82f7d379c32 trac/trac/web/main.py
+--- a/trac/trac/web/main.py	Tue Feb 25 00:16:54 2014 +0000
++++ b/trac/trac/web/main.py	Sat Mar 01 10:20:39 2014 -0500
+@@ -33,8 +33,8 @@
+ from genshi.template import TemplateLoader
+ 
+ from trac import __version__ as TRAC_VERSION
+-from trac.config import BoolOption, ExtensionOption, Option, \
+-                        OrderedExtensionsOption
++from trac.config import BoolOption, ConfigurationError, ExtensionOption, \
++                        Option, OrderedExtensionsOption
+ from trac.core import *
+ from trac.env import open_environment
+ from trac.loader import get_plugin_info, match_plugins_to_frames
+@@ -172,7 +172,10 @@
+                             break
+                     if not chosen_handler:
+                         if not req.path_info or req.path_info == '/':
+-                            chosen_handler = self.default_handler
++                            try:
++                                chosen_handler = self.default_handler
++                            except AttributeError, e:
++                                raise ConfigurationError(to_unicode(e))
+                     # pre-process any incoming request, whether a handler
+                     # was found or not
+                     chosen_handler = self._pre_process_request(req,