Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some cleanup #134

Merged
merged 11 commits into from
Nov 1, 2014
Merged

Some cleanup #134

merged 11 commits into from
Nov 1, 2014

Conversation

macro1
Copy link
Collaborator

@macro1 macro1 commented Oct 31, 2014

After I saw the Landscape badge @dnozay added, I decided to see if we could get a few of the issues addressed.

One thing I did that I'm not sure about is explicitly adding object as a base for the manager and admin classes to ensure they are new-type classes.

@@ -27,7 +24,7 @@
USER_NATURAL_KEY = tuple(key.lower() for key in USER_NATURAL_KEY.split('.', 1))


class SimpleHistoryAdmin(admin.ModelAdmin):
class SimpleHistoryAdmin(admin.ModelAdmin, object):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the other object inheritance doesn't make sense to me. admin.ModelAdmin is a new-style class.

@treyhunner
Copy link
Member

👍 except for the object inheritance I don't understand.

@macro1
Copy link
Collaborator Author

macro1 commented Nov 1, 2014

Landscape claimed they were old-object... I'll revert. Maybe it's a 2/3 thing.

macro1 added a commit that referenced this pull request Nov 1, 2014
@macro1 macro1 merged commit 1ca167c into master Nov 1, 2014
@macro1 macro1 deleted the code-quality branch November 1, 2014 20:46
@dnozay
Copy link
Contributor

dnozay commented Nov 1, 2014

I think that for object classes, you can just ignore those until they are addressed upstream (I mean directly in django)

@macro1
Copy link
Collaborator Author

macro1 commented Nov 2, 2014

@dnozay as you can see from our code, we are using super() within those classes. Wouldn't that raise a TypeError if managers and model admins really are old-style objects? Looking at the Django code it seemed like they are dynamic objects constructed using type(), maybe that's why Landscape wasn't detecting it correctly.

@treyhunner
Copy link
Member

@macro1 type makes a new style class

@dnozay
Copy link
Contributor

dnozay commented Nov 5, 2014

this could be some issue in pylint_django that landscape.io uses.

dnozay added a commit to dnozay/pylint-django that referenced this pull request Nov 5, 2014
... subclasses. This is done by exposing a Manager object.
see jazzband/django-simple-history#134 as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants