Skip to content

Commit

Permalink
Fixed #491 -- Non-user connections are now supported for PostgreSQL. …
Browse files Browse the repository at this point in the history
…Thanks, jafo@tummy.com

git-svn-id: http://code.djangoproject.com/svn/django/trunk@647 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
adrianholovaty committed Sep 19, 2005
1 parent 09bd9d3 commit e7982bb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions django/core/db/backends/postgresql.py
Expand Up @@ -17,10 +17,12 @@ def __init__(self):
def cursor(self): def cursor(self):
from django.conf.settings import DATABASE_USER, DATABASE_NAME, DATABASE_HOST, DATABASE_PASSWORD, DEBUG, TIME_ZONE from django.conf.settings import DATABASE_USER, DATABASE_NAME, DATABASE_HOST, DATABASE_PASSWORD, DEBUG, TIME_ZONE
if self.connection is None: if self.connection is None:
if DATABASE_NAME == '' or DATABASE_USER == '': if DATABASE_NAME == '':
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
raise ImproperlyConfigured, "You need to specify both DATABASE_NAME and DATABASE_USER in your Django settings file." raise ImproperlyConfigured, "You need to specify DATABASE_NAME in your Django settings file."
conn_string = "user=%s dbname=%s" % (DATABASE_USER, DATABASE_NAME) conn_string = "dbname=%s" % DATABASE_NAME
if DATABASE_USER:
conn_string = "user=%s %s" % (DATABASE_USER, conn_string)
if DATABASE_PASSWORD: if DATABASE_PASSWORD:
conn_string += " password=%s" % DATABASE_PASSWORD conn_string += " password=%s" % DATABASE_PASSWORD
if DATABASE_HOST: if DATABASE_HOST:
Expand Down

0 comments on commit e7982bb

Please sign in to comment.