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

fix formatting as per pep8 in post_policy.py #888

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions minio/post_policy.py
Expand Up @@ -40,6 +40,7 @@ class PostPolicy(object):
A :class:`PostPolicy <PostPolicy>` object for constructing
Amazon S3 POST policy JSON string.
"""

def __init__(self):
self._expiration = None
self._content_length_range = tuple()
Expand Down Expand Up @@ -113,8 +114,7 @@ def set_content_length_range(self, min_length, max_length):
"""
err_msg = ('Min-length ({}) must be <= Max-length ({}), '
'and they must be non-negative.').format(
min_length, max_length
)
min_length, max_length)
if min_length > max_length or min_length < 0 or max_length < 0:
raise ValueError(err_msg)

Expand All @@ -134,11 +134,10 @@ def _marshal_json(self, extras=()):
list(self._content_length_range))

policy_stmt = {
"expiration": self._expiration.strftime(
"%Y-%m-%dT%H:%M:%S.000Z"),
"expiration": self._expiration.strftime("%Y-%m-%dT%H:%M:%S.000Z"),
}

if len(policies) > 0:
if policies:
policy_stmt["conditions"] = policies

return json.dumps(policy_stmt)
Expand All @@ -157,7 +156,8 @@ def is_valid(self):
Validate for required parameters.
"""
if not isinstance(self._expiration, datetime.datetime):
raise InvalidArgumentError('Expiration datetime must be specified.')
raise InvalidArgumentError(
'Expiration datetime must be specified.')

if 'key' not in self.form_data:
raise InvalidArgumentError('object key must be specified.')
Expand Down