From 98f706f486b827b64ce6561f6896704a041f5c77 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Mon, 28 Sep 2020 14:06:32 -0700 Subject: [PATCH] Let Photo.basename be a @property. --- etiquette/objects.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/etiquette/objects.py b/etiquette/objects.py index 2a42c3c..ee32f2e 100644 --- a/etiquette/objects.py +++ b/etiquette/objects.py @@ -682,7 +682,7 @@ class Photo(ObjectBase): self.id = db_row['id'] self.created = db_row['created'] self.author_id = self.normalize_author_id(db_row['author_id']) - self.basename = db_row['override_filename'] or self.real_path.basename + self.override_filename = db_row['override_filename'] self.extension = db_row['extension'] self.tagged_at = db_row['tagged_at'] @@ -776,6 +776,10 @@ class Photo(ObjectBase): return tag + @property + def basename(self): + return self.override_filename or self.real_path.basename + @property def bitrate(self): if self.duration and self.bytes is not None: @@ -1196,7 +1200,7 @@ class Photo(ObjectBase): 'override_filename': new_filename, } self.photodb.sql_update(table='photos', pairs=data, where_key='id') - self.basename = new_filename + self.override_filename = new_filename self.__reinit__()