app/django/db/backends/postgresql/client.py
author Todd Larsen <tlarsen@google.com>
Thu, 28 Aug 2008 23:54:35 +0000
changeset 119 50d8d58dcd7c
parent 54 03e267d67478
child 323 ff1a9aa48cfd
permissions -rw-r--r--
Add soc.views.simple containing (initially) two simple template views. templateWithLinkName() is a view that can replace most public() read-only views. errorResponse() is a view that renders an error page for out_of_band.ErrorResponse exceptions. Also, change response_helpers.respond() to accept keyword arguments to pass to http.HttpResponse(). (errorResponse() makes use of this new respond() feature.) Patch by: Todd Larsen Review by: to-be-reviewed

from django.conf import settings
import os

def runshell():
    args = ['psql']
    if settings.DATABASE_USER:
        args += ["-U", settings.DATABASE_USER]
    if settings.DATABASE_PASSWORD:
        args += ["-W"]
    if settings.DATABASE_HOST:
        args.extend(["-h", settings.DATABASE_HOST])
    if settings.DATABASE_PORT:
        args.extend(["-p", str(settings.DATABASE_PORT)])
    args += [settings.DATABASE_NAME]
    os.execvp('psql', args)