- map.connect('/forums/{forum_id}/write', controller='forum', action='write_thread')
- map.connect('/forums/{forum_id}/threads/{thread_id}/write', controller='forum', action='write')
-
-class FrontPageNewsPost(object):
- pass
-
-def frontpage_hook(limit):
- """Hook to return recent news for the front page."""
- threads = meta.Session.query(forum_model.Thread) \
- .join(forum_model.Thread.first_post) \
- .order_by(forum_model.Post.posted_time.desc()) \
- [:limit]
-
- updates = []
- for thread in threads:
- update = FrontPageNewsPost()
- update.time = thread.first_post.posted_time
- update.template = '/forum/front_page.mako'
- update.post = thread.first_post
- updates.append(update)
-
- return updates
+ map.connect(r'/forums/{forum_id:\d+}/write', controller='forum', action='write_thread')
+ map.connect(r'/forums/{forum_id:\d+}/threads/{thread_id:\d+}/write', controller='forum', action='write')