Ticket #16770: better_operationalerror.diff

File better_operationalerror.diff, 782 bytes (added by jMyles, 11 years ago)

Not a final patch per se, just a first draft to get the ball rolling. This simply causes OperationalError to be raised instead of TemplateSyntaxError.

  • django/template/debug.py

    33from django.utils.html import escape
    44from django.utils.safestring import SafeData, EscapeData
    55from django.utils.formats import localize
     6from psycopg2 import OperationalError
    79class DebugLexer(Lexer):
    810    def __init__(self, template_string, origin):
    7476            if not hasattr(e, 'source'):
    7577                e.source = node.source
    7678            raise
     79        except OperationalError:
     80            raise
    7781        except Exception, e:
    7882            from sys import exc_info
    7983            wrapped = TemplateSyntaxError(u'Caught %s while rendering: %s' %
Back to Top