diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2020-10-29 19:45:05 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2020-10-29 19:45:05 +0100 |
commit | 2498f142782e26681c542dfca4b3f9fc4ff64808 (patch) | |
tree | 24d63a549fd0a4d4ab039d3b0924f8c611d439c2 /fbin/db.py | |
parent | b1ed551c3125278d14a69750fea2bfe39cf68530 (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.py | 20 |
1 files changed, 1 insertions, 19 deletions
@@ -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()) |