mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-14 18:46:52 +01:00
Chore: switch from os.path to pathlib.Path (#10539)
This commit is contained in:
parent
cc621cf729
commit
d2064a2535
11 changed files with 151 additions and 165 deletions
|
|
@ -19,15 +19,15 @@ migration_1012_obj = importlib.import_module(
|
|||
)
|
||||
|
||||
|
||||
def archive_name_from_filename(filename):
|
||||
return Path(filename).stem + ".pdf"
|
||||
def archive_name_from_filename(filename: Path) -> Path:
|
||||
return Path(filename.stem + ".pdf")
|
||||
|
||||
|
||||
def archive_path_old(self):
|
||||
def archive_path_old(self) -> Path:
|
||||
if self.filename:
|
||||
fname = archive_name_from_filename(self.filename)
|
||||
fname = archive_name_from_filename(Path(self.filename))
|
||||
else:
|
||||
fname = f"{self.pk:07}.pdf"
|
||||
fname = Path(f"{self.pk:07}.pdf")
|
||||
|
||||
return Path(settings.ARCHIVE_DIR) / fname
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue