Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed some Oracle backend test DB creation code bugs.

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

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14489 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 9c619ac48b1e4b61346b97b6838a6efb3416cd70 1 parent 96cc7ba
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()
@@ -131,9 +132,6 @@ def _destroy_test_db(self, test_database_name, verbosity=1):
131 132
             'tblspace_temp': TEST_TBLSPACE_TMP,
132 133
         }
133 134
 
134  
-        self.remember['user'] = self.connection.settings_dict['USER']
135  
-        self.remember['passwd'] = self.connection.settings_dict['PASSWORD']
136  
-
137 135
         cursor = self.connection.cursor()
138 136
         time.sleep(1) # To avoid "database is being accessed by other users" errors.
139 137
         if self._test_user_create():
@@ -210,35 +208,13 @@ def _test_database_name(self):
210 208
                 name = self.connection.settings_dict['TEST_NAME']
211 209
         except AttributeError:
212 210
             pass
213  
-        except:
214  
-            raise
215 211
         return name
216 212
 
217 213
     def _test_database_create(self):
218  
-        name = True
219  
-        try:
220  
-            if self.connection.settings_dict['TEST_CREATE']:
221  
-                name = True
222  
-            else:
223  
-                name = False
224  
-        except KeyError:
225  
-            pass
226  
-        except:
227  
-            raise
228  
-        return name
  214
+        return self.connection.settings_dict.get('TEST_CREATE', True)
229 215
 
230 216
     def _test_user_create(self):
231  
-        name = True
232  
-        try:
233  
-            if self.connection.settings_dict['TEST_USER_CREATE']:
234  
-                name = True
235  
-            else:
236  
-                name = False
237  
-        except KeyError:
238  
-            pass
239  
-        except:
240  
-            raise
241  
-        return name
  217
+        return self.connection.settings_dict.get('TEST_USER_CREATE', True)
242 218
 
243 219
     def _test_database_user(self):
244 220
         name = TEST_DATABASE_PREFIX + self.connection.settings_dict['USER']
@@ -247,8 +223,6 @@ def _test_database_user(self):
247 223
                 name = self.connection.settings_dict['TEST_USER']
248 224
         except KeyError:
249 225
             pass
250  
-        except:
251  
-            raise
252 226
         return name
253 227
 
254 228
     def _test_database_passwd(self):
@@ -258,8 +232,6 @@ def _test_database_passwd(self):
258 232
                 name = self.connection.settings_dict['TEST_PASSWD']
259 233
         except KeyError:
260 234
             pass
261  
-        except:
262  
-            raise
263 235
         return name
264 236
 
265 237
     def _test_database_tblspace(self):
@@ -269,8 +241,6 @@ def _test_database_tblspace(self):
269 241
                 name = self.connection.settings_dict['TEST_TBLSPACE']
270 242
         except KeyError:
271 243
             pass
272  
-        except:
273  
-            raise
274 244
         return name
275 245
 
276 246
     def _test_database_tblspace_tmp(self):
@@ -280,6 +250,4 @@ def _test_database_tblspace_tmp(self):
280 250
                 name = self.connection.settings_dict['TEST_TBLSPACE_TMP']
281 251
         except KeyError:
282 252
             pass
283  
-        except:
284  
-            raise
285 253
         return name

0 notes on commit 9c619ac

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