From austin at pettomato.com Mon Mar 20 04:01:46 2006 From: austin at pettomato.com (Austin Haas) Date: Sun, 19 Mar 2006 23:01:46 -0500 Subject: [cl-who-devel] setting *attribute-quote-char* Message-ID: <441E292A.7030104@pettomato.com> Hi, Could someone please tell me the proper way to set *attribute-quote-char*? I'm a noob, but I've spent the past 4 hours trying every way I could think of, to no avail. If I recompile a handler function, then it will take, but I can't get it to be set when I load the system via asdf. It's likely some ignorance on my part regarding packages or macros, but I would really appreciate it if someone could show me an example of how they use it. Thanks. -austin From edi at agharta.de Mon Mar 20 10:44:10 2006 From: edi at agharta.de (Edi Weitz) Date: Mon, 20 Mar 2006 11:44:10 +0100 Subject: [cl-who-devel] setting *attribute-quote-char* In-Reply-To: <441E292A.7030104@pettomato.com> (Austin Haas's message of "Sun, 19 Mar 2006 23:01:46 -0500") References: <441E292A.7030104@pettomato.com> Message-ID: On Sun, 19 Mar 2006 23:01:46 -0500, Austin Haas wrote: > Could someone please tell me the proper way to set > *attribute-quote-char*? > > I'm a noob, but I've spent the past 4 hours trying every way I could > think of, to no avail. If I recompile a handler function, then it > will take, but I can't get it to be set when I load the system via > asdf. What do you mean by "get it to be set when I load the system?" Which system, CL-WHO or your own system which requires CL-WHO? You want to set the variable before CL-WHO is loaded? From austin at pettomato.com Mon Mar 20 14:28:31 2006 From: austin at pettomato.com (Austin Haas) Date: Mon, 20 Mar 2006 09:28:31 -0500 Subject: [cl-who-devel] setting *attribute-quote-char* In-Reply-To: References: <441E292A.7030104@pettomato.com> Message-ID: <441EBC0F.8080509@pettomato.com> Sorry, I meant my system, which requires CL-WHO. I have this in the main component file of my system: (setq tbnl:*tbnl-port* 3000) (setq cl-who:*attribute-quote-char* #\") (setq cl-who:*prologue* "") (in-package #:pettomato) (defun test-handler() (with-html-output-to-string (*standard-output* nil :prologue t) (:html (:body :bgcolor "black" "Not much there")) (values))) (defun start () (print "Starting server") (terpri) (tbnl:start-tbnl)) (defun stop () (print "Stopping server") (terpri) (tbnl:stop-tbnl)) ;; Route requests to handlers. (setq *dispatch-table* (nconc (mapcar (lambda (args) (apply #'create-regex-dispatcher args)) '(("test\.l" test-handler))) (list #'default-dispatcher))) (start) After the server starts, if I hit the test.l page, I will see that the prologue is still 'strict' and the *attribute-quote-char* is still #\'. If I reevaluate test-handler, then it will take the new values that I set above. Please feel free to bash anything that I'm doing naively. I would very much appreciate it. -austin Edi Weitz wrote: > On Sun, 19 Mar 2006 23:01:46 -0500, Austin Haas wrote: > > >>Could someone please tell me the proper way to set >>*attribute-quote-char*? >> >>I'm a noob, but I've spent the past 4 hours trying every way I could >>think of, to no avail. If I recompile a handler function, then it >>will take, but I can't get it to be set when I load the system via >>asdf. > > > What do you mean by "get it to be set when I load the system?" Which > system, CL-WHO or your own system which requires CL-WHO? You want to > set the variable before CL-WHO is loaded? > From edi at agharta.de Mon Mar 20 15:30:55 2006 From: edi at agharta.de (Edi Weitz) Date: Mon, 20 Mar 2006 16:30:55 +0100 Subject: [cl-who-devel] setting *attribute-quote-char* In-Reply-To: <441EBC0F.8080509@pettomato.com> (Austin Haas's message of "Mon, 20 Mar 2006 09:28:31 -0500") References: <441E292A.7030104@pettomato.com> <441EBC0F.8080509@pettomato.com> Message-ID: On Mon, 20 Mar 2006 09:28:31 -0500, Austin Haas wrote: > Sorry, I meant my system, which requires CL-WHO. > > I have this in the main component file of my system: > > [...] > > After the server starts, if I hit the test.l page, I will see that > the prologue is still 'strict' and the *attribute-quote-char* is > still #\'. If I reevaluate test-handler, then it will take the new > values that I set above. Yeah, that's a matter of macro expansion time vs. compile time vs. load time. Wrap the SETQs with EVAL-WHEN or (better) put them into a file that is LOADed before your functions (using CL-WHO macros) are compiled. HTH, Edi. From adam.thorsen at gmail.com Wed Mar 29 16:23:43 2006 From: adam.thorsen at gmail.com (Adam Thorsen) Date: Wed, 29 Mar 2006 08:23:43 -0800 Subject: [cl-who-devel] Pre-filled forms Message-ID: <290f54b70603290823m6516be60if5d9349e3bf2d6cf@mail.gmail.com> I'm using TBNL in a small web-app. A common need when developing webapps is to display a form with fields pre-populated from the database (i.e. email address, street address, etc.). I'm wondering if it's possible to do this with cl-who in some generic way? I thought perhaps I could customize cl-who using the convert-tag-to-string-list method. The function below overrides default handling of (:input) tags to look for a :tuple attribute with a value set to a hash containing the values from the database needed to pre-fill the form the input element is part of. This approach doesn't work, however, because convert-tag-to-string serializes the string at compile time, and the data needs to be retrieved from the database at run time. Any ideas? (defmethod convert-tag-to-string-list ((tag (eql :input)) attr-list body body-fn) ;;(declare (ignore attr-list)) (let ((name (cdr (assoc :name attr-list))) (type (cdr (assoc :type attr-list))) (tuple (eval (cdr (assoc :tuple attr-list))))) (nconc (cons (format nil "" name type (if tuple (gethash name tuple) "")) (funcall body-fn body)) (list "")))) Thanks, -Adam Thorsen -------------- next part -------------- An HTML attachment was scrubbed... URL: