From 886ceb2a882c8f55c45e5215049cc68b697431df Mon Sep 17 00:00:00 2001 From: KeyserSosa Date: Wed, 10 Sep 2008 12:28:48 -0700 Subject: [PATCH] handles permalinks on cnamed profile pages correctly --- r2/r2/models/link.py | 2 +- r2/r2/templates/link.html | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/r2/r2/models/link.py b/r2/r2/models/link.py index a9775c52c..a7e1ab239 100644 --- a/r2/r2/models/link.py +++ b/r2/r2/models/link.py @@ -219,7 +219,7 @@ class Link(Thing, Printable): if not c.cname: res = "/r/%s/%s" % (sr.name, p) elif sr != c.site or force_domain: - res = "http://%s/r/%s/%s" % (get_domain(cname = c.cname, + res = "http://%s/r/%s/%s" % (get_domain(cname = (c.cname and sr == c.site), subreddit = False), sr.name, p) else: res = "/%s" % p diff --git a/r2/r2/templates/link.html b/r2/r2/templates/link.html index 58455380e..96431a1a1 100644 --- a/r2/r2/templates/link.html +++ b/r2/r2/templates/link.html @@ -84,7 +84,16 @@ <%def name="subreddit()" buffered="True"> - + <% + if c.cname: + path = "http://" + get_domain(cname = (c.site == thing.subreddit), + subreddit = (c.site != thing.subreddit)) + else: + path = thing.subreddit.path + endif + %> + ${thing.subreddit.name}