From 60049c777ffac1d19025b42362c9068bdf6b5aca Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 18 Mar 2018 15:58:51 -0700 Subject: [PATCH] Add method get_author to all objects. --- etiquette/objects.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/etiquette/objects.py b/etiquette/objects.py index 5d7700f..9e20b21 100644 --- a/etiquette/objects.py +++ b/etiquette/objects.py @@ -46,6 +46,14 @@ class ObjectBase: def __hash__(self): return hash(self.id) + def get_author(self): + ''' + Return the User who created this object, or None if it is unassigned. + ''' + if self.author_id is None: + return None + return self.photodb.get_user(id=self.author_id) + class GroupableMixin: group_getter = None @@ -788,14 +796,6 @@ class Photo(ObjectBase): self.__reinit__() return self.thumbnail - def get_author(self): - ''' - Return the User object who owns this photo, or None if it is unassigned. - ''' - if self.author_id is None: - return None - return self.photodb.get_user(id=self.author_id) - def get_containing_albums(self): ''' Return the albums of which this photo is a member.