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

api: Fix python3 compatibility issue by using compat values. #400

Merged
merged 1 commit into from
Aug 31, 2016

Conversation

harshavardhana
Copy link
Member

Also fix the API set_bucket_policy() should take input
policy as the last option and API should be consistent
with other languages.

This patch also adds a functional test case.

Fixes #399

@harshavardhana
Copy link
Member Author

ping @balamurugana

@@ -336,7 +336,8 @@ def get_bucket_policy(self, bucket_name, prefix=""):

return policy.get_policy(statements, bucket_name, prefix)

def set_bucket_policy(self, policy_access, bucket_name, prefix=""):
def set_bucket_policy(self, bucket_name, prefix="",
policy_access=policy.Policy.NONE):
Copy link
Member

Choose a reason for hiding this comment

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

Its good to not to have policy_access is an optional argument.

Copy link
Member Author

Choose a reason for hiding this comment

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

Optional is because its a default case is remove bucket policy.

Copy link
Member

Choose a reason for hiding this comment

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

Why do we need remove as default? In most of the cases a valid bucket policy is set. Having Policy.NONE as default would lead to loosing the policy when the API is called with wrong code. I feel making policy_access mandate to avoid such errors.

Copy link
Member Author

Choose a reason for hiding this comment

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

Why do we need remove as default? In most of the cases a valid bucket policy is set. Having Policy.NONE as default would lead to loosing the policy when the API is called with wrong code. I feel making policy_access mandate to avoid such errors.

That we can do and not have any optional params for this API.

Also fix the API set_bucket_policy() should take input
policy as the last option and API should be consistent
with other languages.

This patch also adds a functional test case.

Fixes minio#399
@balamurugana
Copy link
Member

LGTM 👍

@harshavardhana harshavardhana merged commit def88f9 into minio:master Aug 31, 2016
@harshavardhana harshavardhana deleted the fix-python-3 branch August 31, 2016 19:15
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.

Verify with python 3.5.1
2 participants