Commit dc062e05 authored by Elouan Martinet's avatar Elouan Martinet
Browse files

[storages] Try to download suffixed keys in precommit events

Since the unsuffixed key is saved in database, a precommit event
fetching an edited attribute doesn't download the new value.
parent 392c3681984e
......@@ -51,6 +51,14 @@ class S3Storage(Storage):
"""see docstring for prototype, which vary according to is_source_callback
"""
key = source.binary_to_str(value).decode('utf-8')
if cnx.commit_state == 'precommit':
# download suffixed key if it exists
# FIXME need a way to check that the attribute is actually edited
try:
suffixed_key = self.suffixed_key(key)
return self.download(suffixed_key)
except Exception:
pass
try:
return self.download(key)
except Exception as ex:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment