Opened 10 years ago

Closed 10 years ago

#2952 closed enhancement (wontfix)

Please show location of manage.py errors (& be consistant with max_...)

Reported by: Yary Owned by: Russell Keith-Magee
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: freakboy3742@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I'm working on a medium-sized data model, and am fixing initial typos like missing quotes or caps. The errors manage.py give me are surprisingly vague, since they don't tell me either line number or object:

manage.py validate

Site.Q: name 'name' is not defined
1 error found.

(The identifier 'name' is all over the model, where did I use it wrong?)

manage.py validate

Site.Q: name 'question' is not defined
1 error found.

(same as above... I'd like to know which object model is using
'question' wrong, or a line number...)

manage.py validate

Site.Q: init() got an unexpected keyword argument 'max_length'
1 error found.

(OK I can find max_length, but it irks me that django uses 'max_digits'
with the underscore, but drops the underscore from 'maxlength!)

Change History (2)

comment:1 Changed 10 years ago by Russell Keith-Magee

Cc: freakboy3742@… added
Owner: changed from Adrian Holovaty to Russell Keith-Magee

Can you provide an example model that demonstrates the 'name' not defined errors?

The maxlength/max_digits discrepancy is a separate problem; please file as a unique ticket.

comment:2 Changed 10 years ago by Adrian Holovaty

Resolution: wontfix
Status: newclosed

name 'name' is not defined is not a Django-specific error; it's a Python syntax error. You're trying to use a variable that you haven't defined yet.

For the record, that Python error is collected in django.db.models.loading.get_apps() and used in django.core.management.get_validation_errors(). There doesn't seem to be a way to get the line number of an exception like that without bringing in some other machinery (such as the traceback module), which I see as too heavyweight for use here. Hence, I'm marking this as a wontfix.

Note: See TracTickets for help on using tickets.
Back to Top