Hi,

On Thu, Oct 21, 2010 at 15:53, Nandan Bagchee <[email protected]>wrote:

> Also, where exactly does it fail?
>
>
It failed inside pocetna-stranica (which as far as I have understood the
init-user-session and with-flow stuff is the function for the initial web
page.


> Also wrap on-cancel in a lambda:
>
> :on-cancel (f_% (reset-user-session))
>
>
>
I guess it did part of the stuff. I did the following changes, and now the
form seemingly works. Well, it is the barebone something that allows me to
see the login form. Still, it is much better than nothing. :D

There are several questions that I have now, I have added them inbetween the
code, so that if someone wants to copy&paste this code, it is runable
without much fuss:

(in-package :sem)

;;; http://paste.lisp.org/display/90095
;; Define callback function to initialize new sessions
(defun init-user-session (root)
  (let (proceed f)
    (with-flow root
      (yield #'pocetna-stranica)
      (setf (widget-prefix-fn root) #'render-header)
      (yield (make-instance 'login
;;; what is exactyl pushed to the :on-login? I guess default is
"email/password" data?
    :on-login #'autentikacija-korisnika
    :on-success (lambda (&rest args)
  (f_%
  (setf proceed t)))
;; can I use here weblocks:reset-session or similar? What exactly
;; do I gain with this other than perhaps resetting unsuccessfull login?
;    :on-cancel (reset-user-session)

    ))
      (if proceed
  (yield (glavna-stranica))
  (yield (neuspjeli-login))))))



(defun pocetna-stranica (k)
  "Pocetna stranica koja ce se iscrtavati"
;;; I have read a bit about continuations before, and I have basic
understanding about
;;; the subject. But, the question is, if I comment out the following
;;; setf and lambda, the site works, but did I lose something in the logic
;;; of weblocks functionality? My guess is that here this continuation is
beeing pushed
;;; into children list of the root (main) widget? So commenting out I'm
actually breaking
;;; that structure?
;  (setf (weblocks:widget-children root)
; (lambda (&rest args)
(with-html
  (:strong "pocetna stranica blabla")
  (answer k)))

(defun render-header (k)
  "Render header koji ce se iscrtavati"
;  (setf (weblocks:widget-children root)
; (lambda (&rest args)
(with-html
  (:strong "Header")
  (answer k)))


(defun neuspjeli-login ()
  "U slucaju neuspjelog logina prikazat cemo ovo"
;  (setf (widget-children root)
; (lambda (&rest args)
(with-html
  (:strong "Ovo je neuspjela stranica neuspjeli-login ()")))

-- 
You received this message because you are subscribed to the Google Groups 
"weblocks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/weblocks?hl=en.

Reply via email to