Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.2.X] Fixed some Oracle backend test DB creation code bugs.

Made saving of modified settings compatible with multi-db, removed dead and superfluous code.

Backport of [14489] from trunk

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14490 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 1431bcc70ec46de34080ad0f44c64740e1520704 1 parent 7509bdf
Ramiro Morales authored November 07, 2010

Showing 1 changed file with 5 additions and 37 deletions. Show diff stats Hide diff stats

  1. 42  django/db/backends/oracle/creation.py
42  django/db/backends/oracle/creation.py
... ...
@@ -1,5 +1,4 @@
1 1
 import sys, time
2  
-from django.core import management
3 2
 from django.db.backends.creation import BaseDatabaseCreation
4 3
 
5 4
 TEST_DATABASE_PREFIX = 'test_'
@@ -39,7 +38,9 @@ class DatabaseCreation(BaseDatabaseCreation):
39 38
         'URLField':                     'VARCHAR2(%(max_length)s)',
40 39
     }
41 40
 
42  
-    remember = {}
  41
+    def __init__(self, connection):
  42
+        self.remember = {}
  43
+        super(DatabaseCreation, self).__init__(connection)
43 44
 
44 45
     def _create_test_db(self, verbosity=1, autoclobber=False):
45 46
         TEST_NAME = self._test_database_name()
@@ -135,9 +136,6 @@ def _destroy_test_db(self, test_database_name, verbosity=1):
135 136
             'tblspace_temp': TEST_TBLSPACE_TMP,
136 137
         }
137 138
 
138  
-        self.remember['user'] = self.connection.settings_dict['USER']
139  
-        self.remember['passwd'] = self.connection.settings_dict['PASSWORD']
140  
-
141 139
         cursor = self.connection.cursor()
142 140
         time.sleep(1) # To avoid "database is being accessed by other users" errors.
143 141
         if self._test_user_create():
@@ -214,35 +212,13 @@ def _test_database_name(self):
214 212
                 name = self.connection.settings_dict['TEST_NAME']
215 213
         except AttributeError:
216 214
             pass
217  
-        except:
218  
-            raise
219 215
         return name
220 216
 
221 217
     def _test_database_create(self):
222  
-        name = True
223  
-        try:
224  
-            if self.connection.settings_dict['TEST_CREATE']:
225  
-                name = True
226  
-            else:
227  
-                name = False
228  
-        except KeyError:
229  
-            pass
230  
-        except:
231  
-            raise
232  
-        return name
  218
+        return self.connection.settings_dict.get('TEST_CREATE', True)
233 219
 
234 220
     def _test_user_create(self):
235  
-        name = True
236  
-        try:
237  
-            if self.connection.settings_dict['TEST_USER_CREATE']:
238  
-                name = True
239  
-            else:
240  
-                name = False
241  
-        except KeyError:
242  
-            pass
243  
-        except:
244  
-            raise
245  
-        return name
  221
+        return self.connection.settings_dict.get('TEST_USER_CREATE', True)
246 222
 
247 223
     def _test_database_user(self):
248 224
         name = TEST_DATABASE_PREFIX + self.connection.settings_dict['USER']
@@ -251,8 +227,6 @@ def _test_database_user(self):
251 227
                 name = self.connection.settings_dict['TEST_USER']
252 228
         except KeyError:
253 229
             pass
254  
-        except:
255  
-            raise
256 230
         return name
257 231
 
258 232
     def _test_database_passwd(self):
@@ -262,8 +236,6 @@ def _test_database_passwd(self):
262 236
                 name = self.connection.settings_dict['TEST_PASSWD']
263 237
         except KeyError:
264 238
             pass
265  
-        except:
266  
-            raise
267 239
         return name
268 240
 
269 241
     def _test_database_tblspace(self):
@@ -273,8 +245,6 @@ def _test_database_tblspace(self):
273 245
                 name = self.connection.settings_dict['TEST_TBLSPACE']
274 246
         except KeyError:
275 247
             pass
276  
-        except:
277  
-            raise
278 248
         return name
279 249
 
280 250
     def _test_database_tblspace_tmp(self):
@@ -284,6 +254,4 @@ def _test_database_tblspace_tmp(self):
284 254
                 name = self.connection.settings_dict['TEST_TBLSPACE_TMP']
285 255
         except KeyError:
286 256
             pass
287  
-        except:
288  
-            raise
289 257
         return name

0 notes on commit 1431bcc

Please sign in to comment.
Something went wrong with that request. Please try again.