From 7421e1e320fc46a52af0a1e4518b0ce4344c1a0f Mon Sep 17 00:00:00 2001 From: Shai Berger Date: Fri, 25 Apr 2014 00:36:40 +0300 Subject: [PATCH] [1.7.x] Made sure cursor.close() does not complain if cursor is already closed on Oracle Refs #22483 Backport of 53d97e4fe3 from master --- django/db/backends/oracle/base.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py index 01f4960470..1a4ff172e8 100644 --- a/django/db/backends/oracle/base.py +++ b/django/db/backends/oracle/base.py @@ -917,6 +917,13 @@ class FormatStylePlaceholderCursor(object): def fetchall(self): return tuple(_rowfactory(r, self.cursor) for r in self.cursor.fetchall()) + def close(self): + try: + self.cursor.close() + except Database.InterfaceError: + # already closed + pass + def var(self, *args): return VariableWrapper(self.cursor.var(*args))