summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-03-06 02:38:38 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-03-06 02:38:38 +0000
commitdd5300274f81e8ea41f3ef41487179e2b1770d65 (patch)
tree64dd113eb6bfc3a6270719a250210df82429c74b
parent31e059c9b3a9014e08780eb564d990788d8f1cff (diff)
[1.0.X] Fixed #6710 -- Made DATABASE_OPTIONS work with postgresql_psycopg2 backend.
Thanks to rcoup for the patch. Backport of r9981 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@9982 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--AUTHORS1
-rw-r--r--django/db/backends/postgresql_psycopg2/base.py15
2 files changed, 10 insertions, 6 deletions
diff --git a/AUTHORS b/AUTHORS
index b88cf996de..98713d27f3 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -93,6 +93,7 @@ answer newbie questions, and generally made Django that much better:
colin@owlfish.com
crankycoder@gmail.com
Paul Collier <paul@paul-collier.com>
+ Robert Coup
Pete Crosier <pete.crosier@gmail.com>
Matt Croydon <http://www.postneo.com/>
Leah Culver <leah@pownce.com>
diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py
index 16104277c5..27de942207 100644
--- a/django/db/backends/postgresql_psycopg2/base.py
+++ b/django/db/backends/postgresql_psycopg2/base.py
@@ -72,16 +72,19 @@ class DatabaseWrapper(BaseDatabaseWrapper):
if settings.DATABASE_NAME == '':
from django.core.exceptions import ImproperlyConfigured
raise ImproperlyConfigured("You need to specify DATABASE_NAME in your Django settings file.")
- conn_string = "dbname=%s" % settings.DATABASE_NAME
+ conn_params = {
+ 'database': settings.DATABASE_NAME,
+ }
+ conn_params.update(self.options)
if settings.DATABASE_USER:
- conn_string = "user=%s %s" % (settings.DATABASE_USER, conn_string)
+ conn_params['user'] = settings.DATABASE_USER
if settings.DATABASE_PASSWORD:
- conn_string += " password='%s'" % settings.DATABASE_PASSWORD
+ conn_params['password'] = settings.DATABASE_PASSWORD
if settings.DATABASE_HOST:
- conn_string += " host=%s" % settings.DATABASE_HOST
+ conn_params['host'] = settings.DATABASE_HOST
if settings.DATABASE_PORT:
- conn_string += " port=%s" % settings.DATABASE_PORT
- self.connection = Database.connect(conn_string, **self.options)
+ conn_params['port'] = settings.DATABASE_PORT
+ self.connection = Database.connect(**conn_params)
self.connection.set_isolation_level(1) # make transactions transparent to all cursors
self.connection.set_client_encoding('UTF8')
cursor = self.connection.cursor()