Skip to content
This repository has been archived by the owner on Jul 20, 2018. It is now read-only.

AttributeError: has no attribute '_errors' #4

Open
clayg opened this issue Aug 13, 2010 · 2 comments
Open

AttributeError: has no attribute '_errors' #4

clayg opened this issue Aug 13, 2010 · 2 comments

Comments

@clayg
Copy link

clayg commented Aug 13, 2010

The errors property on models.base should check for _errors first, and if not exists call .is_valid for you

I can:
x = MyModel.objects.create()
x.errors # == []

but not:
x = MyModel()
x.errors # raises AttributeError!

@clayg
Copy link
Author

clayg commented Aug 13, 2010

@clayg
Copy link
Author

clayg commented Aug 13, 2010

I don't think that accessing x.errors before calling x.is_valid should raise an attribute error for missing attribute "_errors":
http://github.com/clayg/redisco/compare/master...issue4
pull request sent.

But I'm not sure how effectively errors can be cached? Maybe the property should always run the full validation suite before returning to prevent divergence? Meh...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant