From ndj at hivsa.com Tue Nov 14 16:00:34 2006 From: ndj at hivsa.com (Nico de Jager) Date: Tue, 14 Nov 2006 18:00:34 +0200 Subject: [cl-who-devel] CL-WHO transformation rule not working? Message-ID: <200611141800.34828.ndj@hivsa.com> Hi It seems that the last transformation rule (and example) for attribute values described in CL-WHO's documentation is not working. I am using: LispWorks 5.0 for Linux (Debian Sarge) CL-WHO-0.6.2 HUNCHENTOOT-0.4.9 E.g. (defun logon-page-html () ;logon-action) (with-html-output (*standard-output*) (:html (:head (:title "test")) (:body "Some text" (:table :border "3" ; Going to change this! (:tr (:td "1-1") (:td "1-2"))))))) gives the following in 2 browsers: Some text 1-1 1-2 html: testSome text
1-11-2
While: (defun logon-page-html () ;logon-action) (with-html-output (*standard-output*) (:html (:head (:title "test")) (:body "Some text" (:table :border (+ 1 2) ;Substituted (+ 1 2) for "3". (:tr (:td "1-1") (:td "1-2"))))))) only gives the following in the same browsers: >1-11-2 html: >1-11-2 The output of both cl-who:show-html-expansion and cl-who:with-html-output appear correct in the listener, though: CL-USER 11 > (cl-who:show-html-expansion (*standard-output*) (:html (:head (:title "test")) (:body "Some text" (:table :border (+ 1 2) (:tr (:td "1-1") (:td "1-2")))))) (LET ((*STANDARD-OUTPUT* *STANDARD-OUTPUT*)) (PROGN NIL (WRITE-STRING "testSome text1-11-2" *STANDARD-OUTPUT*))) It seems that only the output of the last "write-string" is sent to the browser for the second example. Thanks. Nico From edi at agharta.de Tue Nov 14 19:28:19 2006 From: edi at agharta.de (Edi Weitz) Date: Tue, 14 Nov 2006 20:28:19 +0100 Subject: [cl-who-devel] CL-WHO transformation rule not working? In-Reply-To: <200611141800.34828.ndj@hivsa.com> (Nico de Jager's message of "Tue, 14 Nov 2006 18:00:34 +0200") References: <200611141800.34828.ndj@hivsa.com> Message-ID: Hi! On Tue, 14 Nov 2006 18:00:34 +0200, Nico de Jager wrote: > It seems that the last transformation rule (and example) for > attribute values described in CL-WHO's documentation is not working. No, it is working. See below. > I am using: > LispWorks 5.0 for Linux (Debian Sarge) > CL-WHO-0.6.2 > HUNCHENTOOT-0.4.9 > > E.g. > (defun logon-page-html () ;logon-action) > (with-html-output (*standard-output*) > (:html > (:head > (:title "test")) > (:body > "Some text" > (:table :border "3" ; Going to change this! > (:tr (:td "1-1") (:td "1-2"))))))) > > gives the following in 2 browsers: > Some text > 1-1 1-2 > > html: > testSome text border='3'>
1-11-2
> > While: > (defun logon-page-html () ;logon-action) > (with-html-output (*standard-output*) > (:html > (:head > (:title "test")) > (:body > "Some text" > (:table :border (+ 1 2) ;Substituted (+ 1 2) for "3". > (:tr (:td "1-1") (:td "1-2"))))))) > > only gives the following in the same browsers: >>1-11-2 > html: >>1-11-2 > > The output of both cl-who:show-html-expansion and cl-who:with-html-output > appear correct in the listener, though: > CL-USER 11 > (cl-who:show-html-expansion (*standard-output*) > (:html > (:head > (:title "test")) > (:body > "Some text" > (:table :border (+ 1 2) > (:tr (:td "1-1") (:td "1-2")))))) > > (LET ((*STANDARD-OUTPUT* *STANDARD-OUTPUT*)) > (PROGN > NIL > (WRITE-STRING "testSome > text (LET ((#:G4088 (+ 1 2))) > (COND ((NULL #:G4088)) > ((AND (EQ #:G4088 T) (EQ CL-WHO::*HTML-MODE* :XML)) (PROGN > (WRITE-STRING " border='border'" *STANDARD-OUTPUT*))) > ((AND (EQ #:G4088 T) (EQ CL-WHO::*HTML-MODE* :SGML)) (PROGN > (WRITE-STRING " border" *STANDARD-OUTPUT*))) > (T (PROGN (WRITE-STRING " border='" *STANDARD-OUTPUT*) (PRINC > #:G4088 *STANDARD-OUTPUT*) (WRITE-STRING "'" *STANDARD-OUTPUT*))))) > (WRITE-STRING ">1-11-2" > *STANDARD-OUTPUT*))) > > It seems that only the output of the last "write-string" is sent to > the browser for the second example. Your problem is that handlers in Hunchentoot are expected to return a string and the string your first handler returns is only by pure coincidence the result you wanted to have. You're sending the "real" page to *STANDARD-OUTPUT* where it is not seen by Hunchentoot. Try to use WITH-HTML-OUTPUT-TO-STRING instead. That should result in the same page in both cases. Take a look at test/test.lisp in Hunchentoot to see how it's done there. HTH, Edi. From ndj at hivsa.com Wed Nov 15 06:58:12 2006 From: ndj at hivsa.com (Nico de Jager) Date: Wed, 15 Nov 2006 08:58:12 +0200 Subject: [cl-who-devel] CL-WHO transformation rule not working? In-Reply-To: References: <200611141800.34828.ndj@hivsa.com> Message-ID: <200611150858.12645.ndj@hivsa.com> On Tuesday 14 November 2006 21:28, Edi Weitz wrote: > Hi! > > On Tue, 14 Nov 2006 18:00:34 +0200, Nico de Jager wrote: > > It seems that the last transformation rule (and example) for > > attribute values described in CL-WHO's documentation is not working. > > No, it is working. See below. > > > I am using: > > LispWorks 5.0 for Linux (Debian Sarge) > > CL-WHO-0.6.2 > > HUNCHENTOOT-0.4.9 > > > > E.g. > > (defun logon-page-html () ;logon-action) > > (with-html-output (*standard-output*) > > (:html > > (:head > > (:title "test")) > > (:body > > "Some text" > > (:table :border "3" ; Going to change this! > > (:tr (:td "1-1") (:td "1-2"))))))) > > > > gives the following in 2 browsers: > > Some text > > 1-1 1-2 > > > > html: > > testSome text > border='3'>
1-11-2
> > > > While: > > (defun logon-page-html () ;logon-action) > > (with-html-output (*standard-output*) > > (:html > > (:head > > (:title "test")) > > (:body > > "Some text" > > (:table :border (+ 1 2) ;Substituted (+ 1 2) for "3". > > (:tr (:td "1-1") (:td "1-2"))))))) > > > > only gives the following in the same browsers: > >>1-11-2 > > > > html: > >>1-11-2 > > > > The output of both cl-who:show-html-expansion and cl-who:with-html-output > > appear correct in the listener, though: > > CL-USER 11 > (cl-who:show-html-expansion (*standard-output*) > > (:html > > (:head > > (:title "test")) > > (:body > > "Some text" > > (:table :border (+ 1 2) > > (:tr (:td "1-1") (:td "1-2")))))) > > > > (LET ((*STANDARD-OUTPUT* *STANDARD-OUTPUT*)) > > (PROGN > > NIL > > (WRITE-STRING "testSome > > text > (LET ((#:G4088 (+ 1 2))) > > (COND ((NULL #:G4088)) > > ((AND (EQ #:G4088 T) (EQ CL-WHO::*HTML-MODE* :XML)) (PROGN > > (WRITE-STRING " border='border'" *STANDARD-OUTPUT*))) > > ((AND (EQ #:G4088 T) (EQ CL-WHO::*HTML-MODE* :SGML)) (PROGN > > (WRITE-STRING " border" *STANDARD-OUTPUT*))) > > (T (PROGN (WRITE-STRING " border='" *STANDARD-OUTPUT*) (PRINC > > #:G4088 *STANDARD-OUTPUT*) (WRITE-STRING "'" *STANDARD-OUTPUT*))))) > > (WRITE-STRING > > ">1-11-2" > > *STANDARD-OUTPUT*))) > > > > It seems that only the output of the last "write-string" is sent to > > the browser for the second example. > > Your problem is that handlers in Hunchentoot are expected to return a > string and the string your first handler returns is only by pure > coincidence the result you wanted to have. You're sending the "real" > page to *STANDARD-OUTPUT* where it is not seen by Hunchentoot. > > Try to use WITH-HTML-OUTPUT-TO-STRING instead. That should result in > the same page in both cases. Take a look at test/test.lisp in > Hunchentoot to see how it's done there. > > HTH, > Edi. Doh! Shame on me! I used TBNL and CL-WHO long ago and did not read the docs and examples again to get a proper grasp of it. Anyway, thanks Edi, and special thanks for all your great work. Nico From vamlists at gmail.com Fri Nov 17 17:54:45 2006 From: vamlists at gmail.com (Vamsee Kanakala) Date: Fri, 17 Nov 2006 23:24:45 +0530 Subject: [cl-who-devel] Newbie confusion Message-ID: <455DF765.1080402@gmail.com> Hi, I suspect this has got to do with not properly understanding what gensym does, but I think this should work, but I'm only getting empty
  • elements from the list-items function. Where am I going wrong? (defun list-items () (let ((=value= (gensym))) (loop for =value= to 15 collecting `((:li (write-to-string ,=value=)))))) (defmacro show-errors () `(with-html-output (*standard-output*) (:div :id "errorExplanation" (:ul ,@(list-items))))) Thanks, Vamsee. From vamlists at gmail.com Sat Nov 18 04:51:49 2006 From: vamlists at gmail.com (Vamsee Kanakala) Date: Sat, 18 Nov 2006 10:21:49 +0530 Subject: [cl-who-devel] Re: Newbie confusion In-Reply-To: <455DF765.1080402@gmail.com> References: <455DF765.1080402@gmail.com> Message-ID: <455E9165.3000509@gmail.com> Sorry, don't bother - I didn't realize that I have to use esc for displaying strings - been jumping through all kinds of hoops to find out why the text wasn't showing up :) Vamsee Kanakala wrote: > Hi, > > > I suspect this has got to do with not properly understanding what gensym > does, but I think this should work, but I'm only getting empty
  • > elements from the list-items function. Where am I going wrong? > > (defun list-items () > (let ((=value= (gensym))) > (loop for =value= to 15 collecting > `((:li (write-to-string ,=value=)))))) > > (defmacro show-errors () > `(with-html-output (*standard-output*) > (:div :id "errorExplanation" > (:ul ,@(list-items))))) > > > Thanks, > Vamsee. >