From 1c3cde4598a5cc216489c3e0d49a5fcbde86a500 Mon Sep 17 00:00:00 2001 From: shuffman Date: Thu, 26 Jun 2008 13:58:05 -0700 Subject: [PATCH] fix issue with old comment pages that don't have sr_id's --- r2/r2/models/link.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/r2/r2/models/link.py b/r2/r2/models/link.py index 7c57606d8..e1d580e08 100644 --- a/r2/r2/models/link.py +++ b/r2/r2/models/link.py @@ -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))