Browse Source

remove string-is-nil-or-empty? in utils and export it in validation.

This is a port I've been meaning to do for a while now; I just haven't got
around to it until now. This commit doesn't refactor the code in web.lisp to
call the ported code from validation -- it's just the first step in the port.
stable
Craig Oates 2 years ago
parent
commit
0b2980f1d7
  1. 12
      src/utils.lisp
  2. 4
      src/validation.lisp

12
src/utils.lisp

@ -56,18 +56,6 @@ allows each 'keyword' to have (white-)spaces."
(read-from-string key))
:collect value))
;; PORT CODE TO NO LONGER CALL THIS VERSION OF THE FUNCTION (MOVED TO VALIDATION PACKAGE).
(defun string-is-nil-or-empty? (string-to-test)
"Tests to see if `STRING-TO-TEST' is empty of just whitespace.
This is essentially the 'IsNullOrWhiteSpace' function I use in C#. It
expands the 'empty string' check to include a check to see if there is
string with just a '(white) space' in it."
(if (or (string= string-to-test " ")
(zerop (length string-to-test))
(null string-to-test))
t
nil))
(defun separate-files-in-web-request (request &optional request-value)
"Creates a new list of 'upload' files from a web `REQUEST'.
You will mostly use this for processing a multi-file upload (HTML)

4
src/validation.lisp

@ -4,7 +4,8 @@
#:app-constants)
(:export #:has-static-assets-extention?
#:is-valid-favicon-type?
#:favicon-need-resizing?)
#:favicon-need-resizing?
#:string-is-nil-or-empty?)
(:documentation "Package for validating 'stuff'."))
(in-package #:validation)
@ -29,7 +30,6 @@ Valid file types are 'ico', 'gif' and 'png'."
filename)
(t nil)))
;; TODO: PORT CODE TO CALL THIS VERSION OF STRING-IS-NIL-OR-EMPTY?
(defun string-is-nil-or-empty? (string-to-test)
"Tests to see if `STRING-TO-TEST' is empty of just whitespace.
This is essentially the 'IsNullOrWhiteSpace' function I use in C#. It

Loading…
Cancel
Save