[Bese-devel] UCW question

Le grand pinguin rm at mh-freiburg.de
Mon Nov 8 14:22:15 UTC 2004


Hi everyone,

just looking at the sources i stumbled accross the following in login.lisp:


 (defmethod render-on ((res response) (l login))
   (<:div :id "ucw-login"
       (when (login.message l)
             (<:div :id "ucw-login-message" (<:as-html (login.message l))))

What's that supposed to do? If the message slot is set to a string it'll
emit this string wrapped in a div tag. If the string is empty it'll emit
a (harmless) empty div tag. But if the slot is not set this code will
raise a slot-unbound exception. Shuoldn't that be taken care of?

Something like this:

 (defmethod render-on ((res response) (l login))
   (<:div :id "ucw-login"
       (when (and (slot-boundp l 'message)
                  (> (length (login.message l)) 0))
             (<:div :id "ucw-login-message" (<:as-html (login.message l))))

(I think slot-boundp is probably enough).

 TIA Ralf Mattes





More information about the bese-devel mailing list