;;;; Programmer: Kevin M. Rosenberg
;;;; Date Started: Dec 2002
;;;;
-;;;; $Id: base.lisp,v 1.13 2003/07/16 20:40:43 kevin Exp $
+;;;; $Id: base.lisp,v 1.14 2003/08/18 05:48:55 kevin Exp $
;;;; *************************************************************************
(in-package #:modlisp)
(defun read-modlisp-header ()
(loop for key = (read-modlisp-line)
- while (and key
- (string-not-equal key "end")
- (> (length key) 1))
+ while (and key (string-not-equal key "end"))
for value = (read-modlisp-line)
collect (cons (ensure-keyword key) value)))
;;;; Programmer: Kevin M. Rosenberg
;;;; Date Started: Dec 2002
;;;;
-;;;; $Id: utils.lisp,v 1.9 2003/08/10 17:56:44 kevin Exp $
+;;;; $Id: utils.lisp,v 1.10 2003/08/18 05:48:55 kevin Exp $
;;;; *************************************************************************
(in-package #:modlisp)
;; Utility functions for library users
-(defun query-to-alist (posted-string)
+(defun query-to-alist (posted-string &key (keyword t))
"Converts a posted string to an assoc list of keyword names and values,
\"a=1&bc=demo\" => ((:a . \"1\") (:bc . \"demo\"))"
(when posted-string
(let ((name-val-list (kmrcl:delimited-string-to-list name=val #\=)))
(if (= 2 (length name-val-list))
(destructuring-bind (name val) name-val-list
- (push (cons (kmrcl:ensure-keyword name)
+ (push (cons (if keyword
+ (kmrcl:ensure-keyword name)
+ name)
(kmrcl:decode-uri-query-string val))
alist))
(cmsg-c :debug "Invalid number of #\= in ~S" name-val-list)))))))
+
+