fix issue with old comment pages that don't have sr_id's

This commit is contained in:
shuffman
2008-06-26 13:58:05 -07:00
parent c85295342a
commit 1c3cde4598

View File

@@ -347,7 +347,12 @@ class Comment(Thing, Printable):
#fetch parent links
links = Link._byID(set(l.link_id for l in wrapped), True)
subreddits = Subreddit._byID(set(c.sr_id for c in wrapped),
#get srs for comments that don't have them (old comments)
for cm in wrapped:
if not hasattr(cm, 'sr_id'):
cm.sr_id = links[cm.link_id].sr_id
subreddits = Subreddit._byID(set(cm.sr_id for cm in wrapped),
data=True,return_dict=False)
can_reply_srs = set(s._id for s in subreddits if s.can_comment(user))