mirror of
https://github.com/django/django.git
synced 2025-08-06 03:48:38 +00:00
Fixed #29501 -- Allowed dbshell to pass options to underlying tool.
This commit is contained in:
parent
8e8c3f964e
commit
5b884d45ac
13 changed files with 117 additions and 21 deletions
|
@ -9,7 +9,7 @@ class DatabaseClient(BaseDatabaseClient):
|
|||
executable_name = 'psql'
|
||||
|
||||
@classmethod
|
||||
def runshell_db(cls, conn_params):
|
||||
def runshell_db(cls, conn_params, parameters):
|
||||
args = [cls.executable_name]
|
||||
|
||||
host = conn_params.get('host', '')
|
||||
|
@ -29,6 +29,7 @@ class DatabaseClient(BaseDatabaseClient):
|
|||
if port:
|
||||
args += ['-p', str(port)]
|
||||
args += [dbname]
|
||||
args.extend(parameters)
|
||||
|
||||
sigint_handler = signal.getsignal(signal.SIGINT)
|
||||
subprocess_env = os.environ.copy()
|
||||
|
@ -50,5 +51,5 @@ class DatabaseClient(BaseDatabaseClient):
|
|||
# Restore the original SIGINT handler.
|
||||
signal.signal(signal.SIGINT, sigint_handler)
|
||||
|
||||
def runshell(self):
|
||||
DatabaseClient.runshell_db(self.connection.get_connection_params())
|
||||
def runshell(self, parameters):
|
||||
self.runshell_db(self.connection.get_connection_params(), parameters)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue