Do not try to get private attributes for comments
Most probably, they are sqlalchemy's!
This commit is contained in:
parent
645599c2ba
commit
cacc679a24
@ -998,10 +998,17 @@ class Comment(Base):
|
|||||||
return self.comment().get_actor # noqa
|
return self.comment().get_actor # noqa
|
||||||
|
|
||||||
def __getattr__(self, attr):
|
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:
|
try:
|
||||||
|
_log.debug('Old attr is being accessed: {0}'.format(attr))
|
||||||
return getattr(self.comment(), attr) # noqa
|
return getattr(self.comment(), attr) # noqa
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
_log.error(e)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
class TextComment(Base, TextCommentMixin, CommentingMixin):
|
class TextComment(Base, TextCommentMixin, CommentingMixin):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user