Ticket #314: spiffy-request-vars-as-boolean.patch

File spiffy-request-vars-as-boolean.patch, 778 bytes (added by Moritz Heidkamp, 12 years ago)
  • spiffy-request-vars.scm

     
    1515  ;; A list of strings to be considered `#t' for request variables
    1616  ;; when `as-boolean' is used as converter.
    1717  (make-parameter
    18    '("y" "yes" "1" "on")))
     18   '("y" "yes" "1" "on" "true")))
    1919
    2020(define (req-vars/vals var vars/vals)
    2121  (and vars/vals
     
    2929
    3030(define (as-boolean var vals)
    3131  (and-let* ((val (alist-ref var vals)))
    32     (not (not (member val (true-boolean-values) string-ci=?)))))
     32    (or (eqv? #t val)
     33        (not (not (member val (true-boolean-values) string-ci=?))))))
    3334
    3435(define (as-list var vals)
    3536  (let ((vals (req-vars/vals var vals)))