Changeset 10861 in project for release/3/web-unity


Ignore:
Timestamp:
05/17/08 21:50:13 (12 years ago)
Author:
sjamaan
Message:

Use keyword arguments, which are much more appropriate here

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/3/web-unity/trunk/web-unity.scm

    r10859 r10861  
    110110
    111111;;; Cookie procedures taken from spiffy-utils and ported to WU
    112 (define (wu:cookie-set! name value . args)
     112(define (wu:cookie-set! name value #!key (comment #f) (max-age #f) (domain #f) (path #f) (secure #f))
    113113  (let ((conc-cond (lambda (s1 s2 s3) (if s2 (conc s1 s2 s3) ""))))
    114     (let-optionals args ((comment #f) (max-age #f) (domain #f) (path #f)
    115                          (secure #f))
    116                    (wu:set-header! "Set-Cookie"
    117                     (string-append (->string name) "=\"" (->string value) "\""
    118                                    (conc-cond "; Comment=\"" comment "\"")
    119                                    (conc-cond "; Max-Age=\"" max-age "\"")
    120                                    (conc-cond "; Domain=\"" domain "\"")
    121                                    (conc-cond "; Path=\"" path "\"")
    122                                    (if secure "; Secure" "")
    123                                    "; Version=1")))))
     114    (wu:set-header!
     115     "Set-Cookie"
     116     (string-append (->string name) "=\"" (->string value) "\""
     117                    (conc-cond "; Comment=\"" comment "\"")
     118                    (conc-cond "; Max-Age=\"" max-age "\"")
     119                    (conc-cond "; Domain=\"" domain "\"")
     120                    (conc-cond "; Path=\"" path "\"")
     121                    (if secure "; Secure" "")
     122                    "; Version=1"))))
    124123
    125124;;; Delete a cookie by settings its maximum age to 0 seconds
    126 (define (wu:cookie-delete! name . args)
    127   (let-optionals args ((domain #f) (path #f))
    128     (wu:cookie-set! (->string name) "" #f 0 domain path)))
     125(define (wu:cookie-delete! name #!key (domain #f) (path #f))
     126  (wu:cookie-set! (->string name) max-age: 0 domain: domain path: path))
    129127
    130128; Get "cookie variable" value
Note: See TracChangeset for help on using the changeset viewer.