Hello,

We're using pylint and Django in Pydev on Eclipse.

Recently, some of our team upgraded from Pylint 0.18 to 0.21, and one of the features that doesn't seem to work anymore is passing '--generated-members=objects' to prevent pylint from complaining about the auto-generated 'objects' instance variable on Django Model classes.

Now, I've done a bunch of googling, and it looks the feature should still be present, and indeed:

# pylint --long-help
[...]
    --generated-members=<members names>
                        List of members which are set dynamically and missed
                        by pylint inference system, and so shouldn't trigger
                        E0201 when accessed. [current:
                        REQUEST,acl_users,aq_parent]
[...]

But for whatever reason, statements like:

    reports = MyModel.objects.filter(is_authoritative=True)


Yields an error like this one:

E1101: 36:my_method: Class 'MyModel' has no 'objects' member

I noticed in the documentation that --generated-members is supposed to prevent E0201 errors, rather than the E1101 error I'm seeing.

Does anyone know how to prevent this type of error? In pylint 0.18 (and I believe 0.19), --generated-members=objects did the trick for our Django models.

What is the recommended practice now?

PS - I tested using a 'test2' generated-members argument, and that also triggered the same error E1101 with a test class, so it doesn't seem to be related to the name 'objects'.

I also found this ticket:


but wasn't sure if it was strictly the same issue (though it sure seems to be).


Best,
David Allison
Head of Engineering & Development
BrightScope, Inc.
[email protected]

_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to