as
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
26 additions and
15 deletions
-
deletefb/tools/archive.py
|
@ -49,9 +49,20 @@ class Archive: |
|
|
self._bloom_filter.add(content.name) |
|
|
self._bloom_filter.add(content.name) |
|
|
return |
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FakeArchive: |
|
|
|
|
|
def archive(self, content): |
|
|
|
|
|
""" |
|
|
|
|
|
Do not archive an object |
|
|
|
|
|
""" |
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@contextmanager |
|
|
@contextmanager |
|
|
def archiver(archive_type): |
|
|
def archiver(archive_type): |
|
|
|
|
|
if not settings["ARCHIVE"]: |
|
|
|
|
|
yield FakeArchive() |
|
|
|
|
|
else: |
|
|
archive_file = open( |
|
|
archive_file = open( |
|
|
str((Path(".") / Path(archive_type).name).with_suffix(".log.{0}".format(time()))), |
|
|
str((Path(".") / Path(archive_type).name).with_suffix(".log.{0}".format(time()))), |
|
|
mode="ta", |
|
|
mode="ta", |
|
|