Skip to content

Commit

Permalink
Update _validators.py
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinhzy authored Nov 15, 2024
1 parent caddb49 commit f37f820
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ def validator(cmd, namespace):
clear_content_settings = ns.pop('clear_content_settings', False)

# retrieve the existing object properties for an update
props = None
if update and not clear_content_settings:
account = ns.get('account_name')
key = ns.get('account_key')
Expand Down Expand Up @@ -672,12 +673,12 @@ def validator(cmd, namespace):
)

# if update, fill in any None values with existing
if update:
if update and props:
if not clear_content_settings:
for attr in ['content_type', 'content_disposition', 'content_encoding', 'content_language',
'content_md5', 'cache_control']:
if getattr(new_props, attr) is None:
setattr(new_props, attr, getattr(props, attr)) # pylint: disable=used-before-assignment
setattr(new_props, attr, getattr(props, attr))
else:
if guess_from_file:
new_props = guess_content_type(ns[guess_from_file], new_props, settings_class)
Expand Down

0 comments on commit f37f820

Please sign in to comment.