1) MediaComment's author method conflicts with the author
field. So rename it to get_author.
2) Turn it from a normal function into a python property.
That means you call it by ".get_author" not by
".get_author()". This is exactly what sqlalchemy gives
us free of charge.
def media_entry(self):
return self.db.MediaEntry.find_one({'_id': self['media_entry']})
- def author(self):
+ @property
+ def get_author(self):
return self.db.User.find_one({'_id': self['author']})
{% endif %}
{% if comments %}
{% for comment in comments %}
- {% set comment_author = comment.author() %}
+ {% set comment_author = comment.get_author %}
{% if pagination.active_id == comment._id %}
<div class="comment_wrapper comment_active" id="comment-{{ comment._id }}">
<a name="comment" id="comment"></a>