Fixed #2278 -- Fixed some argument parsing problems with the PostgreSQL

dbshell. Also added in the process name to the arg list so that the output of
'ps' looks sensible.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3278 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2006-07-05 10:12:58 +00:00
parent c2556874d4
commit e8ef80c130
1 changed files with 5 additions and 4 deletions

View File

@ -2,13 +2,14 @@ from django.conf import settings
import os import os
def runshell(): def runshell():
args = [''] args = ['psql']
args += ["-U%s" % settings.DATABASE_USER] if settings.DATABASE_USER:
args += ["-U", settings.DATABASE_USER]
if settings.DATABASE_PASSWORD: if settings.DATABASE_PASSWORD:
args += ["-W"] args += ["-W"]
if settings.DATABASE_HOST: if settings.DATABASE_HOST:
args += ["-h %s" % settings.DATABASE_HOST] args.extend(["-h", settings.DATABASE_HOST])
if settings.DATABASE_PORT: if settings.DATABASE_PORT:
args += ["-p %s" % settings.DATABASE_PORT] args.extend(["-p", str(settings.DATABASE_PORT)])
args += [settings.DATABASE_NAME] args += [settings.DATABASE_NAME]
os.execvp('psql', args) os.execvp('psql', args)