Fixing docs/config.rst and code formatting

This commit is contained in:
Bernhard Reiter 2021-06-02 13:52:10 +02:00
parent 9a1582cc0f
commit b9f5d88af9
No known key found for this signature in database
GPG key ID: 2B7BA3BF9BC3A554
2 changed files with 15 additions and 5 deletions

View file

@ -422,7 +422,7 @@ Local
:param fileext: The file extension to use (e.g. ``.txt``). Contained in the
href, so if you change the file extension after a sync, this will
trigger a re-download of everything (but *should* not cause data-loss
of any kind). To be compatible with the ``vset to the empty string`` format you have
of any kind). To be compatible with the ``vset`` format you have
to either use ``.vcf`` or ``.ics``. Note that metasync won't work
if you use an empty string here.
:param encoding: File encoding for items, both content and filename.

View file

@ -22,8 +22,15 @@ class FilesystemStorage(Storage):
storage_name = "filesystem"
_repr_attributes = ("path",)
def __init__(self, path, fileext,
encoding="utf-8", post_hook=None, fileignoreext=".tmp", **kwargs):
def __init__(
self,
path,
fileext,
encoding="utf-8",
post_hook=None,
fileignoreext=".tmp",
**kwargs
):
super().__init__(**kwargs)
path = expand_path(path)
checkdir(path, create=False)
@ -82,8 +89,11 @@ class FilesystemStorage(Storage):
def list(self):
for fname in os.listdir(self.path):
fpath = os.path.join(self.path, fname)
if os.path.isfile(fpath) and fname.endswith(self.fileext) and (
not fname.endswith(self.fileignoreext)):
if (
os.path.isfile(fpath)
and fname.endswith(self.fileext)
and (not fname.endswith(self.fileignoreext))
):
yield fname, get_etag_from_file(fpath)
def get(self, href):