Skip to content

Commit

Permalink
gis: Fixed #5435 with patch from rcoup.
Browse files Browse the repository at this point in the history
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@6238 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
jbronn committed Sep 14, 2007
1 parent e0a665e commit 57135b1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions django/contrib/gis/db/backend/postgis/creation.py
Expand Up @@ -28,8 +28,10 @@ def _create_with_cursor(db_name, verbosity=1, autoclobber=False):


# Constructing the necessary SQL to create the database (the DATABASE_USER # Constructing the necessary SQL to create the database (the DATABASE_USER
# must possess the privileges to create a database) # must possess the privileges to create a database)
create_sql = 'CREATE DATABASE %s OWNER %s' % (connection.ops.quote_name(db_name), create_sql = 'CREATE DATABASE %s' % connection.ops.quote_name(db_name)
settings.DATABASE_USER) if settings.DATABASE_USER:
create_sql += ' OWNER %s' % settings.DATABASE_USER

cursor = connection.cursor() cursor = connection.cursor()
_set_autocommit(connection) _set_autocommit(connection)


Expand Down Expand Up @@ -133,10 +135,11 @@ def drop_db(db_name=False, test=False):
def get_cmd_options(db_name): def get_cmd_options(db_name):
"Obtains the command-line PostgreSQL connection options for shell commands." "Obtains the command-line PostgreSQL connection options for shell commands."
# The db_name parameter is optional # The db_name parameter is optional
options = ''
if db_name: if db_name:
options = '-d %s -U %s ' % (db_name, settings.DATABASE_USER) options += '-d %s ' % db_name
else: if settings.DATABASE_USER:
options = '-U %s ' % settings.DATABASE_USER options += '-U %s ' % settings.DATABASE_USER
if settings.DATABASE_HOST: if settings.DATABASE_HOST:
options += '-h %s ' % settings.DATABASE_HOST options += '-h %s ' % settings.DATABASE_HOST
if settings.DATABASE_PORT: if settings.DATABASE_PORT:
Expand Down

0 comments on commit 57135b1

Please sign in to comment.