Browse Source

refactor nera: call string-is-nil-or-empty? from validation package.

This is part of a multi-part commit to port the string-is-nil-or-empty? function
from the utils package to the validation package. The code has a lot of
'utils:string-is-nil-or-empty?' dotted around so this took a few commits to
port. There is a chance I've missed it in some obsure places so don't be
surprised if you see a future commit relaying something similar to this one.
stable
Craig Oates 2 years ago
parent
commit
ae51da0277
  1. 9
      src/nera.lisp
  2. 1
      src/utils.lisp

9
src/nera.lisp

@ -6,6 +6,7 @@
#:hermetic
#:ritherdon-archive.db
#:utils
#:validation
#:user
#:pages
#:files
@ -142,9 +143,9 @@
(with-connection (db)
(let ((user-to-update
(mito:find-dao 'user:user :username username)))
(if (not (utils:string-is-nil-or-empty? display-name))
(if (not (validation:string-is-nil-or-empty? display-name))
(setf (user::display-name-of user-to-update) display-name))
(if (not (utils:string-is-nil-or-empty? new-password))
(if (not (validation:string-is-nil-or-empty? new-password))
(setf (user::password-of user-to-update) (hermetic::hash new-password)))
(mito:save-dao user-to-update))))
@ -196,9 +197,9 @@ editted article entry as the first item in the list.."
"Add a new `PAGE' to the database."
(with-connection (db)
(let ((page-to-update (mito:find-dao 'page :id id)))
(if (not (utils:string-is-nil-or-empty? title))
(if (not (validation:string-is-nil-or-empty? title))
(setf (pages::title-of page-to-update) title))
(if (not (utils:string-is-nil-or-empty? slug))
(if (not (validation:string-is-nil-or-empty? slug))
(setf (pages::slug-of page-to-update) slug))
(if (not (null nav-menu))
(setf (pages::enable-nav-menu-p page-to-update) nav-menu))

1
src/utils.lisp

@ -7,7 +7,6 @@
#:app-constants
#:storage)
(:export #:request-params
#:string-is-nil-or-empty?
#:separate-files-in-web-request
#:set-alert
#:get-alert

Loading…
Cancel
Save