Opened 18 years ago

Closed 18 years ago

#3486 closed (worksforme)

Cryptic error message

Reported by: Dave Abrahams <dave@…> Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

class Conference(models.Model):
    name = models.CharField(maxlength=100, unique_for_year=start)
    # slug = models.SlugField(prepopulate_from=('name',))
    start = models.DateField('Date on which to start the schedule')
    finish = models.DateField('Date on which to end the schedule')

    def __str__(self):
        return '%s %s' % (self.name,self.start.year)
    
    class Admin: pass

yields:

ProgrammingError: ERROR:  relation "auth_user" does not exist

Change History (11)

comment:1 by Malcolm Tredinnick, 18 years ago

What do you have to do in order to make the error message appear?

comment:2 by Dave Abrahams <dave@…>, 18 years ago

I think it was just a syncdb

comment:3 by ramiro <rm0 _at_ gmx.net>, 18 years ago

I cant't reproduce this. I'd say it is obviously related to another
part of the models.py file the reporter didn't include in the excerpt
he posted.

There is a suer error (with the use of the unique_for_year option) that
syncdb detects and reports but I don't think this ticket is the place to talk
about that.

comment:4 by Michael Radziej <mir@…>, 18 years ago

Resolution: worksforme
Status: newclosed

It's not possible to find out whether this is a bug or a usage error with the information you provide. As it smells a bit for a usage error, can you please try your luck on django-users and reopen the ticket if this was found to be an error in django?

comment:5 by Dave Abrahams <dave@…>, 18 years ago

Resolution: worksforme
Status: closedreopened

It's certainly a usage error! start should have been quoted. The complaint is about the quality of the error message, which ought to tell me if a string field name is required to be passed rather than the field itself.

comment:6 by James Bennett, 18 years ago

I'm not entirely certain how we're getting from an unquoted string to auth_user...

I'm also not certain why you're not immediately getting a NameError that start isn't bound to anything at the time you're trying to use it.

This one's gonna need some digging.

comment:7 by Michael Radziej <mir@…>, 18 years ago

I still don't see how to produce this message. I get this:

$ python manage.py syncdb
Error: Couldn't install apps, because there were errors in one or more models:
testproj.testapp: name 'start' is not defined

and that's because in the first line, the variable 'start' has not been defined.

Please explain how you get this message.

comment:8 by Dave Abrahams <dave@…>, 18 years ago

There were other things in the global namespace, obviously. I don't know if I
can reconstruct the scenario exactly, but what happens if you precede the declaration with

 start = 1

?

in reply to:  6 comment:9 by Michael Radziej <mir@…>, 18 years ago

Replying to ubernostrum:

I'm not entirely certain how we're getting from an unquoted string to auth_user...

I'm also not certain why you're not immediately getting a NameError that start isn't bound to anything at the time you're trying to use it.

This one's gonna need some digging.

I don't understand your decision to reopen this bug. In my opinion, this is a clear 'worksforme'.

comment:10 by Dave Abrahams <dave@…>, 18 years ago

I reopened it because it seemed to have been closed based only on a misunderstanding of the report (the comment asked me to determine whether it was usage error or a django bug). If I were a django devel who wanted to close it, it would be on the grounds that the reporter didn't provide enough info to fully reproduce the problem, not "worksforme," since the example, as written, clearly can't work. Personally I'd be eager to find out why the error message isn't more useful, but it's your project.

comment:11 by Michael Radziej <mir@…>, 18 years ago

Resolution: worksforme
Status: reopenedclosed

Well. As much as I try, I cannot reproduce it. Please reopen when you have found a way to reproduce it.

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