-
Notifications
You must be signed in to change notification settings - Fork 329
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
make_bucket: use region passed via constructor #1103
Conversation
@@ -619,7 +619,7 @@ def make_bucket(self, bucket_name, location=None, object_lock=False): | |||
self._base_url.region, location, | |||
), | |||
) | |||
location = location or "us-east-1" | |||
location = self._base_url.region or location or "us-east-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.
location = self._base_url.region or location or "us-east-1" | |
location = location or self._base_url.region or "us-east-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.
Should it be this, as the user is explicitly specifying the location they want to use, even if the region is set in the constructor?
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.
No. It is not allowed. It will make confusion in other APIs.
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.
This is a general comment.
Wouldn't it be better to define a constant for the default region instead of hard coding it in several different places (5) in the code?
_DEFAULT_REGION = "us-east-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.
I think this is out of scope of this PR.
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.
so, if region
is specified in the constructor, and also specified in the make_bucket
call and they are different, do we reject it?
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.
yep
@@ -619,7 +619,7 @@ def make_bucket(self, bucket_name, location=None, object_lock=False): | |||
self._base_url.region, location, | |||
), | |||
) | |||
location = location or "us-east-1" | |||
location = self._base_url.region or location or "us-east-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.
This is a general comment.
Wouldn't it be better to define a constant for the default region instead of hard coding it in several different places (5) in the code?
_DEFAULT_REGION = "us-east-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.
LGTM
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.
LGTM
Fixes #1102