Browse Source

More robust handling of paths in archiver

pull/53/head
Wesley Kerfoot 6 years ago
parent
commit
17f00abff7
  1. 6
      deletefb/tools/archive.py

6
deletefb/tools/archive.py

@ -1,5 +1,6 @@
from .config import settings from .config import settings
from contextlib import contextmanager from contextlib import contextmanager
from pathlib import Path
import attr import attr
import json import json
@ -18,8 +19,6 @@ class Archive:
archive_type = attr.ib() archive_type = attr.ib()
# We give the Archive class a file handle # We give the Archive class a file handle
# This is better because the archive function
# should not know about anything related to filesystem paths
archive_file = attr.ib() archive_file = attr.ib()
_bloom_filter = attr.ib(factory=make_filter) _bloom_filter = attr.ib(factory=make_filter)
@ -37,8 +36,9 @@ class Archive:
@contextmanager @contextmanager
def archiver(archive_type): def archiver(archive_type):
archive_file = open( archive_file = open(
"./{0}.log".format(archive_type), (Path(".") / Path(archive_type).name).with_suffix(".log"),
mode="ta", mode="ta",
buffering=1 buffering=1
) )

Loading…
Cancel
Save