Ticket #491: pgsql-nouser.patch

File pgsql-nouser.patch, 1.2 KB (added by jafo@…, 19 years ago)

pgsql-nouser.patch

  • core/db/backends/postgresql.py

     
    1717    def cursor(self):
    1818        from django.conf.settings import DATABASE_USER, DATABASE_NAME, DATABASE_HOST, DATABASE_PASSWORD, DEBUG, TIME_ZONE
    1919        if self.connection is None:
    20             if DATABASE_NAME == '' or DATABASE_USER == '':
     20            if DATABASE_NAME == '':
    2121                from django.core.exceptions import ImproperlyConfigured
    22                 raise ImproperlyConfigured, "You need to specify both DATABASE_NAME and DATABASE_USER in your Django settings file."
    23             conn_string = "user=%s dbname=%s" % (DATABASE_USER, DATABASE_NAME)
     22                raise ImproperlyConfigured, "You need to specify the DATABASE_NAME in your Django settings file."
     23            conn_string = "dbname=%s" % DATABASE_NAME
     24            if DATABASE_USER:
     25                conn_string = "user=%s %s" % ( DATABASE_USER, conn_string )
    2426            if DATABASE_PASSWORD:
    2527                conn_string += " password=%s" % DATABASE_PASSWORD
    2628            if DATABASE_HOST:
Back to Top