Skip to content

Commit 4b7f9ca

Browse files
committed
- filter files in _list by pattern, add notebook to be inherited by storage backend implementation
1 parent a3d9615 commit 4b7f9ca

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

storage_backend/README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Contributors
5757
* Benoît Guillot <[email protected]>
5858
* Laurent Mignon <[email protected]>
5959
* Denis Roussel <[email protected]>
60+
* Giovanni Serra <[email protected]>
6061

6162
Maintainers
6263
~~~~~~~~~~~

storage_backend/components/filesystem_adapter.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Copyright 2017 Akretion (http://www.akretion.com).
22
# @author Sébastien BEAU <[email protected]>
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4-
54
import os
65

76
from odoo import _

storage_backend/models/storage_backend.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
# @author Sébastien BEAU <[email protected]>
33
# Copyright 2019 Camptocamp SA (http://www.camptocamp.com).
44
# @author Simone Orsi <[email protected]>
5+
# Copyright 2020 Giovanni Serra
56
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
6-
77
import base64
8+
import fnmatch
89
import logging
910

1011
from odoo import fields, models
@@ -42,8 +43,11 @@ def _add_bin_data(self, relative_path, data, **kwargs):
4243
def _get_bin_data(self, relative_path, **kwargs):
4344
return self._forward("get", relative_path, **kwargs)
4445

45-
def _list(self, relative_path=""):
46-
return self._forward("list", relative_path)
46+
def _list(self, relative_path="", pattern=False):
47+
names = self._forward("list", relative_path)
48+
if pattern:
49+
names = fnmatch.filter(names, pattern)
50+
return names
4751

4852
def _delete(self, relative_path):
4953
return self._forward("delete", relative_path)

storage_backend/views/backend_storage_view.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<field name="backend_type"/>
2727
<field name="directory_path"/>
2828
</group>
29+
<notebook name="backend_config" attrs="{'invisible': [('backend_type', '=', False)]}" />
2930
</sheet>
3031
</form>
3132
</field>

0 commit comments

Comments
 (0)