1
0
mirror of https://github.com/gryf/pygtktalog.git synced 2025-12-17 19:40:21 +01:00

Changing soft fields for Image object

Till now there was an idea to expose full path to image file and thumbnail.
It's quite impossible in certain situations, where path to the media files is
not known. Therefore 'imagepath' was removed due to redundancy with filename
stored in db, and 'thumpath', which now is a simple calculation of the
expected thumbnail relative filepath.
This commit is contained in:
2016-11-17 18:42:51 +01:00
parent a87da6b27c
commit 33a8f99d48

View File

@@ -213,20 +213,13 @@ class Image(Base):
return img return img
@property @property
def thumbpath(self): def thumbnail(self):
""" """
Return full path to thumbnail of this image Return path to thumbnail for this image
""" """
path, fname = os.path.split(self.filename) path, fname = os.path.split(self.filename)
base, ext = os.path.splitext(fname) base, ext = os.path.splitext(fname)
return os.path.join(self.img_path, path, base + "_t" + ext) return os.path.join(path, base + "_t" + ext)
@property
def imagepath(self):
"""
Return full path to image
"""
return os.path.join(self.img_path, self.filename)
def __repr__(self): def __repr__(self):
return "<Image('%s', %s)>" % (str(self.filename), str(self.id)) return "<Image('%s', %s)>" % (str(self.filename), str(self.id))