diff --git a/docs/config.rst b/docs/config.rst index 0ec8695..454074a 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -408,6 +408,7 @@ Local fileext = "..." #encoding = "utf-8" #post_hook = null + #fileextignore = ".tmp" Can be used with `khal `_. See :doc:`vdir` for a more formal description of the format. @@ -426,6 +427,8 @@ Local :param post_hook: A command to call for each item creation and modification. The command will be called with the path of the new/updated file. + :param fileextignore: The file extention to ignore, + the default is ``.tmp``. .. storage:: singlefile diff --git a/vdirsyncer/storage/filesystem.py b/vdirsyncer/storage/filesystem.py index 1e47ba1..1fd1ac6 100644 --- a/vdirsyncer/storage/filesystem.py +++ b/vdirsyncer/storage/filesystem.py @@ -22,13 +22,15 @@ class FilesystemStorage(Storage): storage_name = "filesystem" _repr_attributes = ("path",) - def __init__(self, path, fileext, encoding="utf-8", post_hook=None, **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) self.path = path self.encoding = encoding self.fileext = fileext + self.fileignoreext = fileignoreext self.post_hook = post_hook @classmethod @@ -81,7 +83,7 @@ class FilesystemStorage(Storage): 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('.tmp')): + not fname.endswith(self.fileignoreext)): yield fname, get_etag_from_file(fpath) def get(self, href):