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/controllers/post.py b/scribeengine/controllers/post.py index cba2b1f..b8bd3d8 100644 --- a/scribeengine/controllers/post.py +++ b/scribeengine/controllers/post.py @@ -47,7 +47,8 @@ class PostController(BaseController): c.post = Session.query(Post).get(id) c.page_title = 'Edit Post: %s' % c.post.title return render(u'/post/edit.mako') - + + @authenticate(u'Edit My Posts') def edit_POST(self, id=None): url = utils.generate_url(c.form_values[u'title']) if id is None: 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 @@