#26573: Empty 'AssertionError' exception message on syntax error ({% else if 
%}) in
templates
-------------------------------+-------------------------------------------
     Reporter:  vakorol        |      Owner:  nobody
         Type:  Uncategorized  |     Status:  new
    Component:  Template       |    Version:  1.8
  system                       |
     Severity:  Normal         |   Keywords:  assertionerror template elsif
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+-------------------------------------------
 If one erroneously uses `{% else if ... %}` instead of `{% elif ... %}` in
 django templates:

 {{{
 {% if task.status == TASK_STATUS_DONE %}
     ...
 {% else if task.status == TASK_STATUS_ERROR or task.status ==
 TASK_STATUS_ABORTED %}
     ...
 {% endif %}
 }}}

 then the following error without any message emerges:

 {{{
 AssertionError at /wizard/tasks/1/summary
 No exception message supplied

 Environment:

 Request Method: GET
 Request URL: http://127.0.0.1:20090/wizard/tasks/1/summary

 Django Version: 1.8.13
 Python Version: 3.4.3
 Installed Applications:
 ('django.contrib.admin',
  'django.contrib.auth',
  'django.contrib.contenttypes',
  'django.contrib.sessions',
  'django.contrib.messages',
  'django.contrib.staticfiles',
  'rest_framework',
  'bootstrap3',
  'djkombu',
   ...)
 Installed Middleware:
 ('django.contrib.sessions.middleware.SessionMiddleware',
  'django.middleware.common.CommonMiddleware',
  'django.middleware.csrf.CsrfViewMiddleware',
  'django.contrib.auth.middleware.AuthenticationMiddleware',
  'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
  'django.contrib.messages.middleware.MessageMiddleware',
  'django.middleware.clickjacking.XFrameOptionsMiddleware',
  'django.middleware.security.SecurityMiddleware',
  'viking.middleware.LoginRequiredMiddleware')


 Traceback:
 File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py"
 in get_response
   132.                     response = wrapped_callback(request,
 *callback_args, **callback_kwargs)
 File "/usr/local/lib/python3.4/dist-
 packages/django/views/decorators/csrf.py" in wrapped_view
   58.         return view_func(*args, **kwargs)
 File "/usr/local/lib/python3.4/dist-packages/django/views/generic/base.py"
 in view
   71.             return self.dispatch(request, *args, **kwargs)
 File "/usr/local/lib/python3.4/dist-packages/rest_framework/views.py" in
 dispatch
   466.             response = self.handle_exception(exc)
 File "/usr/local/lib/python3.4/dist-packages/rest_framework/views.py" in
 dispatch
   463.             response = handler(request, *args, **kwargs)
 File "/usr/local/lib/python3.4/dist-packages/rest_framework/decorators.py"
 in handler
   53.             return func(*args, **kwargs)
 File "/www/deploy/apps/wizard/views.py" in task_id_step
   156.         return render_to_response( "wizard/step_summary.html",
 template_data )
 File "/usr/local/lib/python3.4/dist-packages/django/shortcuts.py" in
 render_to_response
   39.         content = loader.render_to_string(template_name, context,
 using=using)
 File "/usr/local/lib/python3.4/dist-packages/django/template/loader.py" in
 render_to_string
   98.             template = get_template(template_name, using=using)
 File "/usr/local/lib/python3.4/dist-packages/django/template/loader.py" in
 get_template
   35.                 return engine.get_template(template_name, dirs)
 File "/usr/local/lib/python3.4/dist-
 packages/django/template/backends/django.py" in get_template
   30.         return Template(self.engine.get_template(template_name,
 dirs))
 File "/usr/local/lib/python3.4/dist-packages/django/template/engine.py" in
 get_template
   167.         template, origin = self.find_template(template_name, dirs)
 File "/usr/local/lib/python3.4/dist-packages/django/template/engine.py" in
 find_template
   141.                 source, display_name = loader(name, dirs)
 File "/usr/local/lib/python3.4/dist-
 packages/django/template/loaders/base.py" in __call__
   13.         return self.load_template(template_name, template_dirs)
 File "/usr/local/lib/python3.4/dist-
 packages/django/template/loaders/base.py" in load_template
   23.             template = Template(source, origin, template_name,
 self.engine)
 File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in
 __init__
   191.         self.nodelist = engine.compile_string(template_string,
 origin)
 File "/usr/local/lib/python3.4/dist-packages/django/template/engine.py" in
 compile_string
   261.         return parser.parse()
 File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in
 parse
   342.                     compiled_result = compile_func(self, token)
 File "/usr/local/lib/python3.4/dist-
 packages/django/template/loader_tags.py" in do_extends
   210.     nodelist = parser.parse()
 File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in
 parse
   342.                     compiled_result = compile_func(self, token)
 File "/usr/local/lib/python3.4/dist-
 packages/django/template/loader_tags.py" in do_block
   184.     nodelist = parser.parse(('endblock',))
 File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in
 parse
   342.                     compiled_result = compile_func(self, token)
 File "/usr/local/lib/python3.4/dist-
 packages/django/template/defaulttags.py" in do_if
   1033.     assert token.contents == 'endif'

 Exception Type: AssertionError at /wizard/tasks/1/summary
 Exception Value:
 }}}

 I think it would be nice to include some meaningful message with the
 exception.

--
Ticket URL: <https://code.djangoproject.com/ticket/26573>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.47e4d5d61a707e36bfb31c71e7ee6595%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to