web/lib/django/db/backends/postgresql/client.py
changeset 38 77b6da96e6f1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/django/db/backends/postgresql/client.py	Wed Jun 02 18:57:35 2010 +0200
@@ -0,0 +1,23 @@
+import os
+import sys
+
+from django.db.backends import BaseDatabaseClient
+
+class DatabaseClient(BaseDatabaseClient):
+    executable_name = 'psql'
+
+    def runshell(self):
+        settings_dict = self.connection.settings_dict
+        args = [self.executable_name]
+        if settings_dict['USER']:
+            args += ["-U", settings_dict['USER']]
+        if settings_dict['HOST']:
+            args.extend(["-h", settings_dict['HOST']])
+        if settings_dict['PORT']:
+            args.extend(["-p", str(settings_dict['PORT'])])
+        args += [settings_dict['NAME']]
+        if os.name == 'nt':
+            sys.exit(os.system(" ".join(args)))
+        else:
+            os.execvp(self.executable_name, args)
+