diff --git a/r2/r2/controllers/buttons.py b/r2/r2/controllers/buttons.py index 567264857..18ba360d1 100644 --- a/r2/r2/controllers/buttons.py +++ b/r2/r2/controllers/buttons.py @@ -70,6 +70,8 @@ class ButtonsController(RedditController): import traceback g.log.debug("FULLPATH: get_link error in buttons code") g.log.debug(traceback.format_exc()) + if wrapper: + return wrapper(None) @validate(url = VSanitizedUrl('url'), diff --git a/r2/r2/lib/jsontemplates.py b/r2/r2/lib/jsontemplates.py index 674ae3b8a..89f87b735 100644 --- a/r2/r2/lib/jsontemplates.py +++ b/r2/r2/lib/jsontemplates.py @@ -20,7 +20,7 @@ # CondeNet, Inc. All Rights Reserved. ################################################################################ from utils import to36, tup, iters -from wrapped import Wrapped, StringTemplate, CacheStub, CachedVariable +from wrapped import Wrapped, StringTemplate, CacheStub, CachedVariable, Templated from mako.template import Template from r2.lib.filters import spaceCompress, safemarkdown import time, pytz @@ -90,7 +90,8 @@ class UserItemJsonTemplate(TableRowTemplate): def cells(self, thing): cells = [] for cell in thing.cells: - r = Templated.part_render(thing, 'cell_type', cell) + thing.name = cell + r = thing.part_render('cell_type', style = "html") cells.append(spaceCompress(r)) return cells diff --git a/r2/r2/models/subreddit.py b/r2/r2/models/subreddit.py index aa619519c..07d071b61 100644 --- a/r2/r2/models/subreddit.py +++ b/r2/r2/models/subreddit.py @@ -242,7 +242,7 @@ class Subreddit(Thing, Printable): @classmethod def add_props(cls, user, wrapped): names = ('subscriber', 'moderator', 'contributor') - rels = (SRMember._fast_query(wrapped, [user], names) if user else {}) + rels = (SRMember._fast_query(wrapped, [user], names) if c.user_is_loggedin else {}) defaults = Subreddit.default_subreddits() for item in wrapped: if not user or not user.has_subscribed: diff --git a/r2/r2/templates/comment.htmllite b/r2/r2/templates/comment.htmllite index ae3b19c6a..034f100a6 100644 --- a/r2/r2/templates/comment.htmllite +++ b/r2/r2/templates/comment.htmllite @@ -30,7 +30,7 @@ <%def name="parent()"> %if c.profilepage: -${thing.ancestor.titleprefix}${thing.ancestor.title}
+${thing.link.title}
%endif diff --git a/r2/r2/templates/comment.mobile b/r2/r2/templates/comment.mobile index e6622ebee..7a4e04b10 100644 --- a/r2/r2/templates/comment.mobile +++ b/r2/r2/templates/comment.mobile @@ -29,7 +29,7 @@ <%def name="parent()"> %if c.profilepage: -${thing.ancestor.titleprefix}${thing.ancestor.title}
+${thing.link.title}
%endif diff --git a/r2/r2/templates/link.wired b/r2/r2/templates/link.wired index 19ec252a9..0fba14d6b 100644 --- a/r2/r2/templates/link.wired +++ b/r2/r2/templates/link.wired @@ -27,7 +27,7 @@ <%inherit file="printable.htmllite" /> <%def name="entry()"> -$num +${thing.num} ${thing.title}  (${thing.domain}) diff --git a/r2/r2/templates/listing.wired b/r2/r2/templates/listing.wired index 717a53716..b5a499084 100644 --- a/r2/r2/templates/listing.wired +++ b/r2/r2/templates/listing.wired @@ -24,7 +24,7 @@ %for a in thing.things: - ${unsafe(replace_render(thing, a))} + ${a} %endfor:
diff --git a/r2/r2/templates/panestack.wired b/r2/r2/templates/panestack.wired index de2d7323c..a167859c6 100644 --- a/r2/r2/templates/panestack.wired +++ b/r2/r2/templates/panestack.wired @@ -25,7 +25,7 @@ ${thing.classname and ("classname=%s" % str(thing.classname))}>\ %endif %for t in thing.stack: - ${t.render()} + ${t} %endfor %if div: diff --git a/r2/r2/templates/reddit.wired b/r2/r2/templates/reddit.wired index f536931a7..2a23cda28 100644 --- a/r2/r2/templates/reddit.wired +++ b/r2/r2/templates/reddit.wired @@ -22,4 +22,4 @@ <%inherit file="base.wired"/> -${thing.content().render()} +${thing.content()} diff --git a/r2/r2/templates/usertableitem.html b/r2/r2/templates/usertableitem.html index 6fcf586ec..c973c2f33 100644 --- a/r2/r2/templates/usertableitem.html +++ b/r2/r2/templates/usertableitem.html @@ -31,8 +31,8 @@ %endfor -<%def name="cell_type(name)"> - %if name == "user": +<%def name="cell_type()"> + %if thing.name == "user": ${plain_link(thing.user.name, "/user/%s/" % thing.user.name, _sr_path=False)} @@ -43,7 +43,7 @@ ${plain_link(_("send message"), "/message/compose?to=%s" % (thing.user.name))}   - %elif name == "remove" and thing.editable: + %elif thing.name == "remove" and thing.editable: ${ynbutton(_("remove"), "removed", "unfriend", callback="deleteRow", hidden_data = dict(type = thing.type,