-
Notifications
You must be signed in to change notification settings - Fork 32
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
Session ID and constructor #400
Merged
Merged
Changes from 4 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
9ae6018
set host and port from client if available
jburel dbf00ab
set session from client
jburel 72d735c
do not close session associated to client
jburel ee24282
remove uncessary check
jburel f30d62a
raise exception if hosts and ports do not match
jburel 65f9d94
fix syntax
jburel 150803b
set the parameters explicitly
jburel 489c78b
set secure flag from client
jburel dd97de9
return correct flag using isSecure
jburel 704e50f
set session ID only
jburel e2025ed
reset sessionUuid
jburel 88d2453
return secure flag
jburel a91f391
check if it is the same session
jburel 4dc40d6
remove comment
jburel e989c33
remove conditional
jburel 2474872
review how secure flag is set
jburel 01fc825
revert to original implementation
jburel 64bf1f9
check compatibility of secure flag
jburel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could imagine an scenario where a user tries to connect to a server with the wrong client object, which would then cause some ambiguity over exactly which server Blitz is connected to.
Could I suggest that we check if self.host is already set to something different here, and if there's a mismatch throw an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add a check but i think people either specify the "client" or the host/user/password
Checking the host does not stop the connection to a wrong server. Using the "connect" specifying the sessionID could lead to that situation cf. one of the examples in the description and there is "false" value return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the gateway is too "flexible" leading to some very strange situations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also set the identity if a client with connection is specified?
the same will apply i.e. checking the value from client and via constructor.
Client with session specified, specify user name and password different from the client ones. Identity in gateway does not correspond to the identity in client
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that people should either specify client or host, but in the event that they don't I think it's safer to avoid silently overriding the user-supplied
host
parameter. Some of the autocompletion tools people now use do have a habit of trying to fill every argument. The user really should be reading the docs, but at the same time I don't think Gateway's Python docs are as helpful as they need to be.You're probably right that Gateway's excessive flexibility here may be causing more problems than it solves. An alternative might be to validate the connection in the client object and outright reject calls with the other parameters specified - you either init with a connected client or supply credentials, no "mix and match".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are other problems especially with the
connect
method since new clients get created (even if one was specified in the constructor).So probably need to describe what we expect from each method moving forward
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The more I look into it the more I notice points that require clarification.
The
clone
method for example will not work when a client with session is specified.To make it works one should do
We also lose info like
useragent
anduserid
in that case