aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Bobrov <breton@cynicmansion.ru>2016-08-08 02:26:25 +0300
committerBoris Bobrov <breton@cynicmansion.ru>2016-08-08 02:26:25 +0300
commitcacc679a24847c9ec24475445068969c4a98b6e3 (patch)
tree5e77267ffa637fcd9bd77254453cf0fd7a1bb087
parent645599c2bafff779d5bb5b7380988f8fee7c3f4a (diff)
downloadmediagoblin-cacc679a24847c9ec24475445068969c4a98b6e3.tar.lz
mediagoblin-cacc679a24847c9ec24475445068969c4a98b6e3.tar.xz
mediagoblin-cacc679a24847c9ec24475445068969c4a98b6e3.zip
Do not try to get private attributes for comments
Most probably, they are sqlalchemy's!
-rw-r--r--mediagoblin/db/models.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
index 6448de36..0a20278f 100644
--- a/mediagoblin/db/models.py
+++ b/mediagoblin/db/models.py
@@ -998,10 +998,17 @@ class Comment(Base):
return self.comment().get_actor # noqa
def __getattr__(self, attr):
+ if attr.startswith('_'):
+ # if attr starts with '_', then it's probably some internal
+ # sqlalchemy variable. Since __getattr__ is called when
+ # non-existing attributes are being accessed, we should not try to
+ # fetch it from self.comment()
+ raise AttributeError
try:
+ _log.debug('Old attr is being accessed: {0}'.format(attr))
return getattr(self.comment(), attr) # noqa
except Exception as e:
- print(e)
+ _log.error(e)
raise
class TextComment(Base, TextCommentMixin, CommentingMixin):