django-extensions/django-extensions — pull request #304 by crccheck (2013-02-10 05:09:05+00:00)
Title: resetdb: fix reset_db would set OWNER = None with no db username for postgresql.

If you use postgresql, and you're lazy like I am and don't set a
username and let postgresql just use `$USER`, your `settings.DATABASE_USER`
will be `None`. This makes the existing code do this:

Executing... "CREATE DATABASE db_name WITH OWNER = None ENCODING = 'UTF8' ;"

Whiiiiicchhh... dies. For me, that looks like:

psycopg2.ProgrammingError: role "none" does not exist

This change omits WITH OWNER when there is no user.

As a side note, it looks like reset_db isn't using the options correctly from the command line if they're specified. But that's another PR.