Commit dd51cf98 authored by Justin Bronn's avatar Justin Bronn
Browse files

[1.0.X] Fixed #10364 -- Correctly identify test spatial database creation errors to the user.

Backport of r10603 from trunk.


git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10604 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent 1c925f65
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -54,7 +54,8 @@ def _create_with_cursor(db_name, verbosity=1, autoclobber=False):
        cursor.execute(create_sql)
        #print create_sql
    except Exception, e:
        # Drop and recreate, if necessary.
        if 'already exists' in e.pgerror.lower():
            # Database already exists, drop and recreate if user agrees.
            if not autoclobber:
                confirm = raw_input("\nIt appears the database, %s, already exists. Type 'yes' to delete it, or 'no' to cancel: " % db_name)
            if autoclobber or confirm == 'yes':
@@ -64,6 +65,8 @@ def _create_with_cursor(db_name, verbosity=1, autoclobber=False):
                cursor.execute(create_sql)
            else:
                raise Exception('Spatial Database Creation canceled.')
        else:
            raise Exception('Spatial database creation failed: "%s"' % e.pgerror.strip())

created_regex = re.compile(r'^createdb: database creation failed: ERROR:  database ".+" already exists')
def _create_with_shell(db_name, verbosity=1, autoclobber=False):