From 7b1cd29c8006045840c5473bbb2c9affa2461fec Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Sun, 26 Jul 2009 22:50:06 -0700 Subject: Fix comment author link when author is a local user. --- quoins/controllers.py | 7 +++++++ quoins/model/blog.py | 8 -------- quoins/templates/delete_post.html | 6 +++--- quoins/templates/post.html | 8 ++++---- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/quoins/controllers.py b/quoins/controllers.py index bf27ddd..f627c61 100644 --- a/quoins/controllers.py +++ b/quoins/controllers.py @@ -335,6 +335,8 @@ class BlogController(TGController): u = tg.url(os.path.join(self.path, 'post', str(obj.id))) elif isinstance(obj, Media): u = tg.url(os.path.join(self.path, 'media', str(obj.post.id), str(obj.name))) + elif isinstance(obj, TGUser): + u = tg.url(os.path.join(self.path, 'author', str(obj.user_name))) return u def absolute_url(self, obj=None): @@ -346,6 +348,11 @@ class BlogController(TGController): port = ':'+port return 'http://%s%s%s'%(tg.config.get('server.webhost'), port, u) + def comment_author_url(self, comment): + if comment.author and (not comment.url): + return self.url(comment.author) + return comment.url + def get_html(self, data): return HTML(data) diff --git a/quoins/model/blog.py b/quoins/model/blog.py index c1689ee..ee99d83 100644 --- a/quoins/model/blog.py +++ b/quoins/model/blog.py @@ -201,14 +201,6 @@ class BaseComment(object): return 'Anonymous' author_name = property(get_author_name) - def get_author_url(self): - if hasattr(self, 'author') and self.author: - return self.author.url - if self.url: - return self.url - return None - author_url = property(get_author_url) - class Comment(BaseComment): pass diff --git a/quoins/templates/delete_post.html b/quoins/templates/delete_post.html index e237dad..94df1d3 100644 --- a/quoins/templates/delete_post.html +++ b/quoins/templates/delete_post.html @@ -57,10 +57,10 @@   - - ${comment.author_name} + + ${comment.author_name} - + ${comment.author_name}
diff --git a/quoins/templates/post.html b/quoins/templates/post.html index 72ee748..d290f3b 100644 --- a/quoins/templates/post.html +++ b/quoins/templates/post.html @@ -51,10 +51,10 @@
  - - ${comment.author_name} + + ${comment.author_name} - + ${comment.author_name}
@@ -62,7 +62,7 @@ ${comment.created.strftime('%B %d, %Y at %I:%M %p')}
- +     Delete comment -- cgit v1.2.3