#19390: NameError in models throws ambiguous message when running syncdb
-------------------------------------+-------------------------------------
     Reporter:  dloewenherz          |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:
  (models, ORM)                      |  1.5-beta-1
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
    Has patch:  0                    |  Unreviewed
  Needs tests:  0                    |      Needs documentation:  0
Easy pickings:  0                    |  Patch needs improvement:  0
                                     |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by dloewenherz):

 I think the traceback is a bit overkill, but just showing the NameError
 without *any* context isn't really enough to do anything about it. I would
 at least show the path of the file where it originated from.

 Also, when running --traceback, it displays the exception twice:

 {{{
 Traceback (most recent call last):
   File "EXAMPLE/lib/python2.7/site-
 packages/django/core/management/base.py", line 222, in run_from_argv
     self.execute(*args, **options.__dict__)
   File "EXAMPLE/lib/python2.7/site-
 packages/django/core/management/base.py", line 251, in execute
     self.validate()
   File "EXAMPLE/lib/python2.7/site-
 packages/django/core/management/base.py", line 277, in validate
     num_errors = get_validation_errors(s, app)
   File "EXAMPLE/lib/python2.7/site-
 packages/django/core/management/validation.py", line 35, in
 get_validation_errors
     for (app_name, error) in get_app_errors().items():
   File "EXAMPLE/lib/python2.7/site-packages/django/db/models/loading.py",
 line 165, in get_app_errors
     self._populate()
   File "EXAMPLE/lib/python2.7/site-packages/django/db/models/loading.py",
 line 71, in _populate
     self.load_app(app_name, True)
   File "EXAMPLE/lib/python2.7/site-packages/django/db/models/loading.py",
 line 95, in load_app
     models = import_module('.models', app_name)
   File "EXAMPLE/lib/python2.7/site-packages/django/utils/importlib.py",
 line 35, in import_module
     __import__(name)
   File "EXAMPLE/app/models.py", line 4, in <module>
     class Example(db.Model):
 NameError: name 'db' is not defined
 NameError: name 'db' is not defined
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/19390#comment:2>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to