Django

Code

Changeset 6

Show
Ignore:
Timestamp:
07/13/05 15:59:56 (3 years ago)
Author:
adrian
Message:

Changed db/backends/postgresql.py to add the password and host params only if they're not blank

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/core/db/backends/postgresql.py

    r3 r6  
    1919        if self.connection is None: 
    2020            # Note that "host=" has to be last, because it might be blank. 
    21             self.connection = Database.connect("user=%s dbname=%s password=%s host=%s" % \ 
    22                 (DATABASE_USER, DATABASE_NAME, DATABASE_PASSWORD, DATABASE_HOST)) 
     21            conn_string = "user=%s dbname=%s" % (DATABASE_USER, DATABASE_NAME) 
     22            if DATABASE_PASSWORD: 
     23                conn_string += " password=%s" % DATABASE_PASSWORD 
     24            if DATABASE_HOST: 
     25                conn_string += " host=%s" % DATABASE_HOST 
     26            self.connection = Database.connect(conn_string) 
    2327            self.connection.set_isolation_level(1) # make transactions transparent to all cursors 
    2428        cursor = self.connection.cursor()