Ticket #10834: ticket10834.diff

File ticket10834.diff, 1.7 KB (added by ccahoon, 15 years ago)

regression text and fix, updated to exclude the else statement

  • django/core/urlresolvers.py

     
    195195                        return sub_match[0], sub_match[1], sub_match_dict
    196196                    tried.append(pattern.regex.pattern)
    197197            raise Resolver404, {'tried': tried, 'path': new_path}
    198 
     198        raise Resolver404, {'path' : path }
     199           
    199200    def _get_urlconf_module(self):
    200201        try:
    201202            return self._urlconf_module
  • tests/regressiontests/urlresolvers/tests.py

     
     1import unittest
     2from django.core.urlresolvers import Resolver404, resolve
     3
     4class EmptyRegexTestCase(unittest.TestCase):
     5    def testBasic(self):
     6        """
     7        Verifies that we raise a Resolver404 if what we are resolving is
     8        not a regular expression. self.regex.search(path) returns None if
     9        path is not a regular expression. We must never return None from
     10        resolve, or we will get a TypeError further down the line.
     11       
     12        In response to ticket #10834.
     13        """
     14        non_regex = ["", "a", "\\", "."]
     15        for test in non_regex:
     16            self.assertRaises(Resolver404, resolve, test)
     17 No newline at end of file
Back to Top