Browse Source

Rename `verify-post-name` `valid-post-name?`

main
Marie-Joseph 1 year ago
parent
commit
83e3409a2f
  1. 6
      app.hy
  2. 2
      blog.hy

6
app.hy

@ -5,7 +5,7 @@ This is the main Flask application for https://tree.st
"""
(import [flask [Flask redirect render-template request session url-for]])
(import [blog [retrieve-posts verify-post-name]])
(import [blog [retrieve-posts valid-post-name?]])
(setv app (Flask __name__))
@ -45,9 +45,9 @@ This is the main Flask application for https://tree.st
:posts (retrieve-posts post-name)
:type "blog")]
;; post-name is checked to be None here as opposed to
;; in verify-post-name so that the regular case (rendering
;; in valid-post-name? so that the regular case (rendering
;; the blog feed) has a slightly lower overhead.
[(or (none? post-name) (verify-post-name post-name))
[(or (none? post-name) (valid-post-name? post-name))
(render-template "blog.html"
:posts (retrieve-posts post-name)
:type "blog")]

2
blog.hy

@ -30,7 +30,7 @@ Blog helper functions
(+ _posts-dir post))
[(+ _posts-dir post-name _posts-suffix)]))
(defn verify-post-name [post-name]
(defn valid-post-name? [post-name]
"""
Ensure post-name refers to an extant post.
Assumes post-name is not None.