diff --git a/scribeengine/config/routing.py b/scribeengine/config/routing.py index 6a91213..db23202 100644 --- a/scribeengine/config/routing.py +++ b/scribeengine/config/routing.py @@ -43,9 +43,9 @@ def make_map(): # CUSTOM ROUTES HERE - map.connect('/archive/{year}', controller='blog', action='archive') - map.connect('/archive/{year}/{month}', controller='blog', action='archive') - map.connect('/archive/{year}/{month}/{day}', controller='blog', action='archive') + map.connect('/archive/{year}', controller='blog', action='archive',month=None,day=None,url=None) + map.connect('/archive/{year}/{month}', controller='blog', action='archive',day=None,url=None) + map.connect('/archive/{year}/{month}/{day}', controller='blog', action='archive',url=None) map.connect('/archive/{year}/{month}/{day}/{url}', controller='blog', action='view') map.connect('/{controller}/{action}') diff --git a/scribeengine/controllers/blog.py b/scribeengine/controllers/blog.py index 12b34e8..349270d 100644 --- a/scribeengine/controllers/blog.py +++ b/scribeengine/controllers/blog.py @@ -88,5 +88,5 @@ class BlogController(BaseController): Session.add(post) Session.commit() h.flash.set_message(u'Successfully submitted your comment.', u'success') - h.redirect_to(h.full_url(post)) + h.redirect_to(h.url_for_post(post)) diff --git a/scribeengine/lib/helpers.py b/scribeengine/lib/helpers.py index 17f1403..613be40 100644 --- a/scribeengine/lib/helpers.py +++ b/scribeengine/lib/helpers.py @@ -78,10 +78,15 @@ def teaser(text, url): text = text[:position] return text -def full_url(post): - return '/archive/%s/%s/%s/%s' % (str(post.created.strftime('%Y')), \ - str(post.created.strftime('%m')), \ - str(post.created.strftime('%d')), \ - str(post.url)) +def url_for_post(post): + #TODO: this is hard coded. + return url_for( + controller='blog', + action='view', + year=post.created.strftime('%Y'), + month=post.created.strftime('%m'), + day=post.created.strftime('%d'), + url=post.url + ) flash = Flash() diff --git a/scribeengine/templates/admin/login.mako b/scribeengine/templates/admin/login.mako index 44fb607..ba5841d 100644 --- a/scribeengine/templates/admin/login.mako +++ b/scribeengine/templates/admin/login.mako @@ -3,7 +3,7 @@

Log in

<%include file="/flash.mako"/> <%include file="/errors.mako"/> -
+
diff --git a/scribeengine/templates/admin/register.mako b/scribeengine/templates/admin/register.mako index c80cab7..d3edd7d 100644 --- a/scribeengine/templates/admin/register.mako +++ b/scribeengine/templates/admin/register.mako @@ -3,7 +3,7 @@

Register

<%include file="/flash.mako"/> <%include file="/errors.mako"/> - +
diff --git a/scribeengine/templates/base.mako b/scribeengine/templates/base.mako index 6538cae..177572b 100644 --- a/scribeengine/templates/base.mako +++ b/scribeengine/templates/base.mako @@ -20,9 +20,9 @@
  • ${page.name}
  • % endfor % if c.current_user: -
  • Logout
  • +
  • Logout
  • % else: -
  • Login
  • +
  • Login
  • % endif
    diff --git a/scribeengine/templates/blog/index.mako b/scribeengine/templates/blog/index.mako index 6b6a0d2..b7f0ea7 100644 --- a/scribeengine/templates/blog/index.mako +++ b/scribeengine/templates/blog/index.mako @@ -2,19 +2,19 @@ <%include file="/flash.mako"/> % for post in c.posts:
    -

    ${post.title}

    +

    ${post.title}

    - ${h.literal(h.teaser(post.body, h.full_url(post)))} + ${h.literal(h.teaser(post.body, h.url_for_post(post)))}

    - Read more + Read more % if len(post.comments) == 0: - No comments + No comments % elif len(post.comments) == 1: - 1 comment + 1 comment % else: - ${len(post.comments)} comments + ${len(post.comments)} comments % endif

    diff --git a/scribeengine/templates/blog/teaser.mako b/scribeengine/templates/blog/teaser.mako index 92dda42..13e84c6 100644 --- a/scribeengine/templates/blog/teaser.mako +++ b/scribeengine/templates/blog/teaser.mako @@ -1,8 +1,8 @@
    <%include file="/flash.mako"/> -

    ${post.title}

    +

    ${post.title}

    ${h.literal(post.body)}
    -

    18 comments

    +

    18 comments

    diff --git a/scribeengine/templates/blog/view.mako b/scribeengine/templates/blog/view.mako index 9fd18bd..36342f3 100644 --- a/scribeengine/templates/blog/view.mako +++ b/scribeengine/templates/blog/view.mako @@ -38,10 +38,10 @@ % if c.post.comment_status == u'open':

    Leave a Reply

    % if not c.current_user: -

    You must be logged in to post a comment.

    +

    You must be logged in to post a comment.

    % else: - -

    Logged in as ${c.current_user.nick}. Logout »

    + +

    Logged in as ${c.current_user.nick}. Logout »

    diff --git a/scribeengine/templates/post/edit.mako b/scribeengine/templates/post/edit.mako index 7f17a2a..c369162 100644 --- a/scribeengine/templates/post/edit.mako +++ b/scribeengine/templates/post/edit.mako @@ -3,7 +3,7 @@

    Edit Post: ${c.post.title}

    <%include file="/flash.mako"/> <%include file="/errors.mako"/> - +
    diff --git a/scribeengine/templates/sidebar.mako b/scribeengine/templates/sidebar.mako index e57ba24..5dfded6 100644 --- a/scribeengine/templates/sidebar.mako +++ b/scribeengine/templates/sidebar.mako @@ -20,7 +20,7 @@

    Categories