From e1608f7e61c8f99aa7b0ec964cefbe8494f6b739 Mon Sep 17 00:00:00 2001 From: Michael van Tellingen Date: Sat, 15 Oct 2011 16:47:00 +0200 Subject: [PATCH] whitespace --- psycopg2ct/_impl/connection.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/psycopg2ct/_impl/connection.py b/psycopg2ct/_impl/connection.py index 0292559..da4079e 100644 --- a/psycopg2ct/_impl/connection.py +++ b/psycopg2ct/_impl/connection.py @@ -36,6 +36,7 @@ def check_closed_(self, *args, **kwargs): return func(self, *args, **kwargs) return check_closed_ + def check_notrans(func): @wraps(func) def check_notrans_(self, *args, **kwargs): @@ -44,6 +45,7 @@ def check_notrans_(self, *args, **kwargs): return func(self, *args, **kwargs) return check_notrans_ + def check_tpc(func): @wraps(func) def check_tpc_(self, *args, **kwargs): @@ -693,32 +695,32 @@ def _process_notifies(self): def _get_exc_type_for_state(self, code): """Translate the sqlstate to a relevant exception. - + See for a list of possible errors: http://www.postgresql.org/docs/current/static/errcodes-appendix.html """ if code[0] == '0': - # Class 0A - Feature Not Supported + # Class 0A - Feature Not Supported if code[1] == 'A': return exceptions.NotSupportedError elif code[0] == '2': # Class 21 - Cardinality Violation - if code[1] == '1': + if code[1] == '1': return exceptions.ProgrammingError # Class 22 - Data Exception - if code[1] == '2': + if code[1] == '2': return exceptions.DataError # Class 23 - Integrity Constraint Violation - if code[1] == '3': + if code[1] == '3': return exceptions.IntegrityError # Class 24 - Invalid Cursor State # Class 25 - Invalid Transaction State - if code[1] in '45': + if code[1] in '45': return exceptions.InternalError # Class 26 - Invalid SQL Statement Name @@ -743,7 +745,7 @@ def _get_exc_type_for_state(self, code): # Class 3B - Savepoint Exception if code[1] in '89B': return exceptions.InternalError - + # Class 3D - Invalid Catalog Name # Class 3F - Invalid Schema Name if code[1] in 'DF': @@ -767,10 +769,10 @@ def _get_exc_type_for_state(self, code): # Class 54 - Program Limit Exceeded # Class 55 - Object Not In Prerequisite State # Class 57 - Operator Intervention - # Class 58 - System Error (errors external to PostgreSQL itself) + # Class 58 - System Error (errors external to PostgreSQL itself) if code in '34578': return exceptions.OperationalError - + elif code[0] == 'F': # Class F0 - Configuration File Error return exceptions.InternalError @@ -782,7 +784,7 @@ def _get_exc_type_for_state(self, code): elif code[0] == 'X': # Class XX - Internal Error return exceptions.InternalError - + # Fallback exception return exceptions.DatabaseError