From 0b2980f1d7f053c4da2f3464e7f7fcf8980ca370 Mon Sep 17 00:00:00 2001 From: Craig Oates Date: Sun, 23 Oct 2022 21:31:49 +0100 Subject: [PATCH] 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. --- src/utils.lisp | 12 ------------ src/validation.lisp | 4 ++-- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/utils.lisp b/src/utils.lisp index d422055..9cfaf52 100644 --- a/src/utils.lisp +++ b/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) diff --git a/src/validation.lisp b/src/validation.lisp index 9ae33a6..a87e671 100644 --- a/src/validation.lisp +++ b/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