Ticket #6907: template_error_silencing_configuration.patch

File template_error_silencing_configuration.patch, 1.7 KB (added by Gabriel Falcão, 16 years ago)

Patch for explicit template fail in settings.py

  • django/template/__init__.py

     
    697697                                # raised in the function itself.
    698698                                current = settings.TEMPLATE_STRING_IF_INVALID # invalid method call
    699699                            except Exception, e:
    700                                 if getattr(e, 'silent_variable_failure', False):
    701                                     current = settings.TEMPLATE_STRING_IF_INVALID
     700                                if getattr(settings, "SHOW_TEMPLATE_ERRORS", False):
     701                                    raise e
    702702                                else:
    703                                     raise
     703                                    if getattr(e, 'silent_variable_failure', False):
     704                                        current = settings.TEMPLATE_STRING_IF_INVALID
     705                                    else:
     706                                        raise
    704707                except (TypeError, AttributeError):
    705708                    try: # list-index lookup
    706709                        current = current[int(bit)]
  • docs/settings.txt

     
    958958
    959959.. _site framework docs: ../sites/
    960960
     961SHOW_TEMPLATE_ERRORS
     962-------
     963
     964Default: ``False``
     965
     966This setting is a flag which tells the django template to don't silence errors.
     967It is useful when developing form widgets, avoiding debug issues, like
     968``SyntaxError``, for example.
     969
    961970TEMPLATE_CONTEXT_PROCESSORS
    962971---------------------------
    963972
Back to Top