mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-24 16:48:36 +00:00
Run manually pre-commit hook
This commit is contained in:
@@ -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('/'),
|
self.storage_path.rstrip('/'),
|
||||||
unicodedata.normalize('NFKC', filename)
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user