On 12.02.2010 12:08, Gary Reynolds wrote: > > Are you saying that the correct behaviour is to throw an IntegrityError > as opposed to a DoesNotExist on accessing the field?
No. It should raise no exception at all. The expression should yield None. It should not be forbidden for an instance to contain invalid data *until* you try to save it. > If so, why would accessing a value on an unsaved instance (which by > definition isn't in the database yet) be an IntegrityError rather than a > DoesNotExist as a result of a lookup? > > It's clearly a design decision. You are free to disagree with that > decision, but it's not a bug - it's behaving as designed (and documented). If this is a topic that has been discussed earlier, then it would be good to find pointers to this discussion. I didn't find any. If at least one core developer would say "maybe Luc is right", then Luke and Karen would maybe agree to reopen the ticket and mark it "needs design decision". And please: I continue to post here because I hope that my explanations can help to understand the problem and to make Django better. I don't want to offend anybody, I am not trying to "win" this "battle", I have no personal interest in having this ticket reopened. If some day I understand that *I* was wrong, then I will apologize for the noise I made. Luc -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.