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

Fix Python3, unorderable types: NoneType() > int() #113

Merged
merged 1 commit into from
Feb 23, 2018

Conversation

dodobas
Copy link
Contributor

@dodobas dodobas commented Feb 22, 2018

No description provided.

if self.request.user.id is not None:
# auto populate modified_by if it is present
if hasattr(obj, 'modified_by_id') and self.request.user.id >= 0:
obj.modified_by = self.request.user
Copy link
Member

Choose a reason for hiding this comment

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

I think you can simplify as if self.request.user.id and hasattr(obj, 'modified_by_id'), no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

was not sure if we request.user.id == 0 is a special use case ? so left that code unchanged

Copy link
Member

Choose a reason for hiding this comment

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

Actually I just looked on prod and AnonymousUser is in there with id -1 - so I think the intention here was to exclude them. So maybe...

if self.request.user.id and self.request.user.id > 0 and hasattr(obj, 'modified_by_id')

@rowanseymour rowanseymour merged commit 07f75c3 into master Feb 23, 2018
@rowanseymour rowanseymour deleted the py3_unorderable_types branch February 23, 2018 14:33
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.

None yet

2 participants