diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-04-01 22:46:46 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-04-01 22:46:46 +0000 |
| commit | 624caace17dbb9e22f5a4c6c08937d68cbdbb066 (patch) | |
| tree | 26e7b428926be78cc16b10cb6e682f27ecdd5d99 /tests | |
| parent | dc832d7753a0c65db5eca5ce0b2d046bd0d299e8 (diff) | |
Fixed #9005: don't wig out when reversing a URL if SETTINGS_MODULE isn't set. While I was there, I fixed #10599 by re-raising the original error message, which is almost always a better idea. Thanks, Eric
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10350 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/templates/tests.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/regressiontests/templates/tests.py b/tests/regressiontests/templates/tests.py index 042aba2f65..cdd499ec83 100644 --- a/tests/regressiontests/templates/tests.py +++ b/tests/regressiontests/templates/tests.py @@ -153,6 +153,21 @@ class Templates(unittest.TestCase): split = token.split_contents() self.assertEqual(split, ["sometag", '_("Page not found")', 'value|yesno:_("yes,no")']) + def test_url_reverse_no_settings_module(self): + #Regression test for #9005 + from django.template import Template, Context, TemplateSyntaxError + old_settings_module = settings.SETTINGS_MODULE + settings.SETTINGS_MODULE = None + t = Template('{% url will_not_match %}') + c = Context() + try: + rendered = t.render(c) + except TemplateSyntaxError, e: + #Assert that we are getting the template syntax error and not the + #string encoding error. + self.assertEquals(e.message, "Caught an exception while rendering: Reverse for 'will_not_match' with arguments '()' and keyword arguments '{}' not found.") + settings.SETTINGS_MODULE = old_settings_module + def test_templates(self): template_tests = self.get_template_tests() filter_tests = filters.get_filter_tests() |
