Author: mtredinnick
Date: 2009-03-05 20:36:56 -0600 (Thu, 05 Mar 2009)
New Revision: 9981

Modified:
   django/trunk/AUTHORS
   django/trunk/django/db/backends/postgresql_psycopg2/base.py
Log:
Fixed #6710 -- Made DATABASE_OPTIONS work with postgresql_psycopg2 backend.

Thanks to rcoup for the patch.

Modified: django/trunk/AUTHORS
===================================================================
--- django/trunk/AUTHORS        2009-03-06 02:09:59 UTC (rev 9980)
+++ django/trunk/AUTHORS        2009-03-06 02:36:56 UTC (rev 9981)
@@ -97,6 +97,7 @@
     [email protected]
     [email protected]
     Paul Collier <[email protected]>
+    Robert Coup
     Pete Crosier <[email protected]>
     Matt Croydon <http://www.postneo.com/>
     Leah Culver <[email protected]>

Modified: django/trunk/django/db/backends/postgresql_psycopg2/base.py
===================================================================
--- django/trunk/django/db/backends/postgresql_psycopg2/base.py 2009-03-06 
02:09:59 UTC (rev 9980)
+++ django/trunk/django/db/backends/postgresql_psycopg2/base.py 2009-03-06 
02:36:56 UTC (rev 9981)
@@ -72,16 +72,19 @@
             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()


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to