summaryrefslogtreecommitdiff
path: root/fbin/db.py
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2020-10-29 19:45:05 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2020-10-29 19:45:05 +0100
commit2498f142782e26681c542dfca4b3f9fc4ff64808 (patch)
tree24d63a549fd0a4d4ab039d3b0924f8c611d439c2 /fbin/db.py
parentb1ed551c3125278d14a69750fea2bfe39cf68530 (diff)
Clean up leftover file path references
This change removes and direct references to the filesystem from the pyfbin code other that file_storage.filesystem. This should hopyfully be the last changes needed for pyfbin to be successfully run using the file_storage.s3 module without any issues.
Diffstat (limited to 'fbin/db.py')
-rw-r--r--fbin/db.py20
1 files changed, 1 insertions, 19 deletions
diff --git a/fbin/db.py b/fbin/db.py
index 876efeb..53b0d8b 100644
--- a/fbin/db.py
+++ b/fbin/db.py
@@ -71,23 +71,9 @@ class File(db.Model):
continue
return '{} B'.format(size)
- def get_path(self):
- return os.path.join(current_app.config['FILE_DIRECTORY'], self.hash + os.path.splitext(self.filename)[1])
-
- def get_thumb_path(self):
- return os.path.join(current_app.config['THUMB_DIRECTORY'], self.hash + '.jpg')
-
- def get_size(self):
- try:
- if self.size:
- return self.size
- return os.path.getsize(self.get_path())
- except OSError:
- return None
-
@property
def formatted_size(self):
- return self.pretty_size(self.get_size())
+ return self.pretty_size(self.size)
@property
def formatted_date(self):
@@ -105,7 +91,3 @@ class File(db.Model):
@property
def ext(self):
return os.path.splitext(self.filename)[1]
-
- @property
- def exists(self):
- return os.path.exists(self.get_path())