GitHub PullRequestReviewCommentEvent at 2014-03-05 21:53:51
Repository: django
Actor: jarshwah
Payload: {"comment":{"url":"https://api.github.com/repos/django/django/pulls/comments/10320578","id":10320578,"diff_hunk":"@@ -216,56 +218,40 @@ def _execute_statements(self, cursor, statements, parameters, verbosity):\n                 sys.stderr.write(\"Failed (%s)\\n\" % (err))\n                 raise\n \n+    def _test_settings_get(self, key, default=None, prefixed=None):\n+        \"\"\"\n+        Return a value from the test settings dict,\n+        or a given default,\n+        or a prefixed entry from the main settings dict\n+        \"\"\"\n+        settings_dict = self.connection.settings_dict\n+        val = settings_dict['TEST'].get(key, default)\n+        if val is None:\n+            val = TEST_DATABASE_PREFIX + settings_dict[prefixed]\n+        return val\n+\n     def _test_database_name(self):\n-        name = TEST_DATABASE_PREFIX + self.connection.settings_dict['NAME']\n-        try:\n-            if self.connection.settings_dict['TEST_NAME']:\n-                name = self.connection.settings_dict['TEST_NAME']\n-        except AttributeError:\n-            pass\n-        return name\n+        return self._test_settings_get('NAME', prefixed='NAME')\n \n     def _test_database_create(self):\n-        return self.connection.settings_dict.get('TEST_CREATE', True)\n+        return self._test_settings_get('CREATE', default=True)\n \n     def _test_user_create(self):\n-        return self.connection.settings_dict.get('TEST_USER_CREATE', True)\n+        return self._test_settings_get('USER_CREATE', default=True)\n \n     def _test_database_user(self):\n-        name = TEST_DATABASE_PREFIX + self.connection.settings_dict['USER']\n-        try:\n-            if self.connection.settings_dict['TEST_USER']:\n-                name = self.connection.settings_dict['TEST_USER']\n-        except KeyError:\n-            pass\n-        return name\n+        return self._test_settings_get('USER', prefixed='USER')\n \n     def _test_database_passwd(self):\n-        name = PASSWORD\n-        try:\n-            if self.connection.settings_dict['TEST_PASSWD']:\n-                name = self.connection.settings_dict['TEST_PASSWD']\n-        except KeyError:\n-            pass\n-        return name\n+        return self._test_settings_get('PASSWD', default=PASSWORD)","path":"django/db/backends/oracle/creation.py","position":63,"original_position":63,"commit_id":"248d7ca232366e8c62e6216390e0b28ca3360000","original_commit_id":"248d7ca232366e8c62e6216390e0b28ca3360000","user":{"login":"jarshwah","id":541083,"avatar_url":"https://gravatar.com/avatar/3891f38e5165127cac92a4e9e4aba688?d=https%3A%2F%2Fidenticons.github.com%2Fcaf9a5eb8954df157c7fda71511f3cf7.png&r=x","gravatar_id":"3891f38e5165127cac92a4e9e4aba688","url":"https://api.github.com/users/jarshwah","html_url":"https://github.com/jarshwah","followers_url":"https://api.github.com/users/jarshwah/followers","following_url":"https://api.github.com/users/jarshwah/following{/other_user}","gists_url":"https://api.github.com/users/jarshwah/gists{/gist_id}","starred_url":"https://api.github.com/users/jarshwah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarshwah/subscriptions","organizations_url":"https://api.github.com/users/jarshwah/orgs","repos_url":"https://api.github.com/users/jarshwah/repos","events_url":"https://api.github.com/users/jarshwah/events{/privacy}","received_events_url":"https://api.github.com/users/jarshwah/received_events","type":"User","site_admin":false},"body":"Since this setting is now in a sub-dictionary and elides the `TEST_` prefix, should the key be named `PASSWORD` rather than `PASSWD` to be more consistent with the non-test settings?","created_at":"2014-03-05T21:53:51Z","updated_at":"2014-03-05T21:53:51Z","html_url":"https://github.com/django/django/pull/2400#discussion_r10320578","pull_request_url":"https://api.github.com/repos/django/django/pulls/2400","_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/comments/10320578"},"html":{"href":"https://github.com/django/django/pull/2400#discussion_r10320578"},"pull_request":{"href":"https://api.github.com/repos/django/django/pulls/2400"}}}}