From 55234867a38b0ade58691560987e4b9d18e522a4 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Sun, 9 Aug 2009 16:43:48 -0700 Subject: Improve linkback handling. Change controller object initialization order. --- quoins/controllers.py | 5 +++-- quoins/model/blog.py | 6 ++++-- quoins/templates/blog-master.html | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/quoins/controllers.py b/quoins/controllers.py index d22cd51..5605c61 100644 --- a/quoins/controllers.py +++ b/quoins/controllers.py @@ -352,7 +352,8 @@ class BlogController(TGController): 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): + if (hasattr(comment, 'author') and comment.author + and (not comment.url)): return self.url(comment.author) return comment.url @@ -398,10 +399,10 @@ Comment: t.start() def __init__(self, *args, **kw): - super(BlogController, self).__init__(*args, **kw) self.path = kw.pop('path', '/') self.post_paginate = kw.pop('paginate', 5) self.feed.blog_controller = self + super(BlogController, self).__init__(*args, **kw) @expose(template="genshi:quoinstemplates.index") def index(self, start=0): diff --git a/quoins/model/blog.py b/quoins/model/blog.py index ee99d83..fb1fa27 100644 --- a/quoins/model/blog.py +++ b/quoins/model/blog.py @@ -198,14 +198,16 @@ class BaseComment(object): return self.author.display_name if self.name: return self.name + if self.url: + return self.url return 'Anonymous' author_name = property(get_author_name) class Comment(BaseComment): - pass + comment_type = 'comment' class LinkBack(BaseComment): - pass + comment_type = 'linkback' mapper(Blog, blog_table, properties=dict(posts=relation(Post, diff --git a/quoins/templates/blog-master.html b/quoins/templates/blog-master.html index a8ad0cc..3428af5 100644 --- a/quoins/templates/blog-master.html +++ b/quoins/templates/blog-master.html @@ -16,7 +16,7 @@
- +

${tg.identity.user.display_name}