Permalink
Browse files

remove unneeded code

  • Loading branch information...
1 parent 740ecd0 commit c5b55fe41aa35249f7be1bfa3509716febdbf061 @paltman paltman committed Jan 23, 2011
Showing with 0 additions and 72 deletions.
  1. +0 −72 nashvegas/utils.py
View
@@ -4,78 +4,6 @@
from django.utils.datastructures import SortedDict
-def _get_postgresql_args(connection, settings_dict):
- args = [connection.client.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']]
- args.extend(["--set", "ON_ERROR_STOP=TRUE"])
- return args
-
-
-def _get_sqlite_args(connection, settings_dict):
- args = [connection.client.executable_name, settings_dict["NAME"]]
- return args
-
-
-def _get_mysql_args(connection, settings_dict):
- args = [connection.client.executable_name]
- db = settings_dict['OPTIONS'].get('db', settings_dict['NAME'])
- user = settings_dict['OPTIONS'].get('user', settings_dict['USER'])
- passwd = settings_dict['OPTIONS'].get('passwd', settings_dict['PASSWORD'])
- host = settings_dict['OPTIONS'].get('host', settings_dict['HOST'])
- port = settings_dict['OPTIONS'].get('port', settings_dict['PORT'])
- defaults_file = settings_dict['OPTIONS'].get('read_default_file')
- # Seems to be no good way to set sql_mode with CLI.
-
- if defaults_file:
- args += ["--defaults-file=%s" % defaults_file]
- if user:
- args += ["--user=%s" % user]
- if passwd:
- args += ["--password=%s" % passwd]
- if host:
- args += ["--host=%s" % host]
- if port:
- args += ["--port=%s" % port]
- if db:
- args += [db]
- return args
-
-
-def _get_oracle_args(connection, settings_dict):
- args = [
- connection.client.executable_name,
- "-L",
- connection._connect_string()
- ]
- return args
-
-
-GET_ARGS_REGISTRY = {
- "django.db.backends.mysql": _get_mysql_args,
- "django.db.backends.oracle": _get_oracle_args,
- "django.db.backends.postgresql_psycopg2": _get_postgresql_args,
- "django.db.backends.postgresql": _get_postgresql_args,
- "django.db.backends.sqlite3": _get_sqlite_args
-}
-
-
-def get_db_exec_args(db):
- """
- Pulled out of django.db.backends.*.client.DatabaseClient
- """
- connection = connections[db]
- settings_dict = connection.settings_dict
- get_args_func = GET_ARGS_REGISTRY.get(settings_dict["ENGINE"], None)
- if get_args_func is not None:
- return get_args_func(connection, settings_dict)
-
-
def get_sql_for_new_models():
"""
Unashamedly copied and tweaked from djang.core.management.commands.syncdb

0 comments on commit c5b55fe

Please sign in to comment.