Switch from os.path to pathlib.Path

This commit is contained in:
Sebastian Steinbeißer
2024-11-30 15:22:42 +01:00
parent aaaa6c1393
commit bd998dac63
17 changed files with 89 additions and 150 deletions

View File

@@ -1,7 +1,7 @@
# Generated by Django 1.9.4 on 2016-03-28 19:09
import hashlib
import os
from pathlib import Path
import django.utils.timezone
import gnupg
@@ -58,16 +58,16 @@ class Document:
@property
def source_path(self):
return os.path.join(
settings.MEDIA_ROOT,
"documents",
"originals",
f"{self.pk:07}.{self.file_type}.gpg",
)
return (
Path(settings.MEDIA_ROOT)
/ "documents"
/ "originals"
/ f"{self.pk:07}.{self.file_type}.gpg"
).as_posix()
@property
def source_file(self):
return open(self.source_path, "rb")
return Path(self.source_path).open("rb")
@property
def file_name(self):