diff options
| author | James E. Blair <corvus@gnu.org> | 2009-08-09 16:43:48 -0700 |
|---|---|---|
| committer | James E. Blair <corvus@gnu.org> | 2009-08-09 16:43:48 -0700 |
| commit | 55234867a38b0ade58691560987e4b9d18e522a4 (patch) | |
| tree | 06e74dc753d687a9289781c0441abb053ff8f803 | |
| parent | c5637f5007a77e242b46ea7012567c5a3e68f501 (diff) | |
Improve linkback handling.
Change controller object initialization order.
| -rw-r--r-- | quoins/controllers.py | 5 | ||||
| -rw-r--r-- | quoins/model/blog.py | 6 | ||||
| -rw-r--r-- | 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): | |||
| 352 | return 'http://%s%s%s'%(tg.config.get('server.webhost'), port, u) | 352 | return 'http://%s%s%s'%(tg.config.get('server.webhost'), port, u) |
| 353 | 353 | ||
| 354 | def comment_author_url(self, comment): | 354 | def comment_author_url(self, comment): |
| 355 | if comment.author and (not comment.url): | 355 | if (hasattr(comment, 'author') and comment.author |
| 356 | and (not comment.url)): | ||
| 356 | return self.url(comment.author) | 357 | return self.url(comment.author) |
| 357 | return comment.url | 358 | return comment.url |
| 358 | 359 | ||
| @@ -398,10 +399,10 @@ Comment: | |||
| 398 | t.start() | 399 | t.start() |
| 399 | 400 | ||
| 400 | def __init__(self, *args, **kw): | 401 | def __init__(self, *args, **kw): |
| 401 | super(BlogController, self).__init__(*args, **kw) | ||
| 402 | self.path = kw.pop('path', '/') | 402 | self.path = kw.pop('path', '/') |
| 403 | self.post_paginate = kw.pop('paginate', 5) | 403 | self.post_paginate = kw.pop('paginate', 5) |
| 404 | self.feed.blog_controller = self | 404 | self.feed.blog_controller = self |
| 405 | super(BlogController, self).__init__(*args, **kw) | ||
| 405 | 406 | ||
| 406 | @expose(template="genshi:quoinstemplates.index") | 407 | @expose(template="genshi:quoinstemplates.index") |
| 407 | def index(self, start=0): | 408 | 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): | |||
| 198 | return self.author.display_name | 198 | return self.author.display_name |
| 199 | if self.name: | 199 | if self.name: |
| 200 | return self.name | 200 | return self.name |
| 201 | if self.url: | ||
| 202 | return self.url | ||
| 201 | return 'Anonymous' | 203 | return 'Anonymous' |
| 202 | author_name = property(get_author_name) | 204 | author_name = property(get_author_name) |
| 203 | 205 | ||
| 204 | class Comment(BaseComment): | 206 | class Comment(BaseComment): |
| 205 | pass | 207 | comment_type = 'comment' |
| 206 | 208 | ||
| 207 | class LinkBack(BaseComment): | 209 | class LinkBack(BaseComment): |
| 208 | pass | 210 | comment_type = 'linkback' |
| 209 | 211 | ||
| 210 | mapper(Blog, blog_table, | 212 | mapper(Blog, blog_table, |
| 211 | properties=dict(posts=relation(Post, | 213 | 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 @@ | |||
| 16 | 16 | ||
| 17 | <div id="blog-navigation-column"> | 17 | <div id="blog-navigation-column"> |
| 18 | <div id="blog-navigation"> | 18 | <div id="blog-navigation"> |
| 19 | <span py:if="request.identity"> | 19 | <span py:if="tg.identity"> |
| 20 | <h3>${tg.identity.user.display_name}</h3> | 20 | <h3>${tg.identity.user.display_name}</h3> |
| 21 | <ul> | 21 | <ul> |
| 22 | <li><a href="${tg.url('/logout_handler')}">Logout</a></li> | 22 | <li><a href="${tg.url('/logout_handler')}">Logout</a></li> |
| @@ -68,7 +68,7 @@ | |||
| 68 | <div id="blog-subscribe"> | 68 | <div id="blog-subscribe"> |
| 69 | <a href="${quoins.url('/feed/rss2_0')}"> | 69 | <a href="${quoins.url('/feed/rss2_0')}"> |
| 70 | <img id="blog-feed-icon" | 70 | <img id="blog-feed-icon" |
| 71 | src="${tg.url('/static/images/feed-icon-20x20.png')}" /> | 71 | src="${tg.url('/images/feed-icon-20x20.png')}" /> |
| 72 | Subscribe to ${blog.title} | 72 | Subscribe to ${blog.title} |
| 73 | </a> | 73 | </a> |
| 74 | </div> | 74 | </div> |
