mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-14 00:26:21 +00:00
Chore: switch from os.path to pathlib.Path (#9060)
This commit is contained in:

committed by
GitHub

parent
aaaa6c1393
commit
76d363f22d
@@ -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):
|
||||
|
Reference in New Issue
Block a user