Run manually pre-commit hook

This commit is contained in:
Denis Leemann
2021-08-09 16:15:45 +02:00
parent e82fe205a0
commit 849181c4a0
+12 -8
View File
@@ -81,26 +81,30 @@ class FileURL(fields.Binary):
storage_location=self._storage_location(), storage_location=self._storage_location(),
force_storage_key=storage_key, force_storage_key=storage_key,
), ),
value value,
) )
return True return True
def _setup_regular_base(self, model): def _setup_regular_base(self, model):
super()._setup_regular_base(model) super()._setup_regular_base(model)
if self.storage_path: if self.storage_path:
assert self.filename is not None, \ assert self.filename is not None, (
"Field %s defines storage_path without filename" % self "Field %s defines storage_path without filename" % self
)
def _build_storage_key(self, filename): def _build_storage_key(self, filename):
return '/'.join([ return '/'.join(
self.storage_path.rstrip('/'), [
unicodedata.normalize('NFKC', filename) self.storage_path.rstrip('/'),
]) unicodedata.normalize('NFKC', filename),
]
)
def _storage_location(self): def _storage_location(self):
# Avoid pushing to s3 in test mode or installation of demo data # Avoid pushing to s3 in test mode or installation of demo data
force_file_storage = config['test_enable'] or config['init'] and \ force_file_storage = (
config['demo'] config['test_enable'] or config['init'] and config['demo']
)
return 'file' if force_file_storage else self.storage_location return 'file' if force_file_storage else self.storage_location