Skip to content

Conversation

@Zil0
Copy link
Contributor

@Zil0 Zil0 commented Jun 8, 2018

Signed-off-by: Valentin Deniaud <valentin.deniaud@inpt.fr>

Copy link
Collaborator

@non-Jedi non-Jedi left a comment

Choose a reason for hiding this comment

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

Thanks for taking the time to cleanup the login methods while adding the device_id parameter. Really appreciate it. :)

}
for key in kwargs:
content[key] = kwargs[key]
if kwargs[key]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm confused by this. We're already iterating through all keys in kwargs. Under what circumstances would kwargs[key] be falsey?

All of this is fine, but in case you aren't aware (as I wasn't until a few months ago), content.update(kwargs) will do this on a single line with no explicit iteration required.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Now reading further on, I see why since we're not validating input in the client method. In light of that, this is fine IMO.

return self.token

def login_with_password(self, username, password, limit=10):
return self.login_with_password(username, password, sync=False)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please include a deprecation warning. :)

Raises:
MatrixRequestError
"""
token = self.login_with_password_no_sync(username, password)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's stick a deprecation warning here, too, and move all this functionality to a vanilla login method. Eventually both username and password will be kwargs and an additional kwarg token will be introduced to allow m.login.token with this same method.

@non-Jedi non-Jedi mentioned this pull request Jun 9, 2018
@Zil0
Copy link
Contributor Author

Zil0 commented Jun 9, 2018

done

@non-Jedi
Copy link
Collaborator

Thanks @Zil0. Pushing a change with a minor tweak to the wording, and then merging this.

@non-Jedi non-Jedi merged commit 7a2642e into matrix-org:master Jun 11, 2018
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.

2 participants