-
Notifications
You must be signed in to change notification settings - Fork 0
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
Test uploaded images with a non-admin user #5
base: feature/cah
Are you sure you want to change the base?
Conversation
src/manage.py
Outdated
port_range_min = port_range[0] | ||
port_range_max = port_range[-1] |
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.
Please use tuple unpacking here (port_range_min, port_range_max = port_range
). This variant behaves better if the length of the list deviates.
src/manage.py
Outdated
def create_security_group(conn, security_group_name, port_range, protocol): | ||
security_group = conn.create_security_group(name=security_group_name, | ||
description="sg for login into a test instance") | ||
if type(port_range) == list: |
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.
-
Don't use
type(x) == A
(except in the most special cases when working with metaclasses and the likes). Useisinstance(x, A)
– this ensures that subclasses are accepted as well. -
I think restricting it to lists is too strict, tuples should be allowed too. The best check would probably be something like
isinstance(port_range, collections.abc.Sequence)
. -
A third (perhaps the best) option would be to remove the functionality of passing in a port range, since it is not used anyway.
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 removed the functionality for now, as it is not used at the time.
e5c0075
to
0f5a6d2
Compare
No description provided.