#24579: With argparse on Python 3, the migrate management command fails when no
database provided
-------------------------------+--------------------
Reporter: bkonkle | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
On Python 3.4, when 'migrate' is invoked with no --database option, the
command fails.
{{{
File
"/Users/brandon.konkle/code/django/django/core/management/commands/migrate.py",
line 70, in handle
connection = connections[db]
File "/Users/brandon.konkle/code/django/django/db/utils.py", line 234,
in __getitem__
if hasattr(self._connections, alias):
TypeError: hasattr(): attribute name must be string
}}}
This is because the newly-introduced argparse resolves `db =
options.get('database')` to `None`, and Python 3 raises a TypeError when
None is used as the first argument to `hasattr`.
--
Ticket URL: <https://code.djangoproject.com/ticket/24579>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.bc817564ffce9fd6a2d6f0ff447e4aec%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.