Here is a cleaned up verios of the log, I hope it helps to explain.

- 11:41 -
nunb: did you get the login flow working?
nunb: http://paste.lisp.org/+1XIN
harag: I am looking at it now
harag: If I use yield in the on-success the code wont compile it says
that yield does not exist
harag: nunb: is f_% an actual function or must I replace it with my own
function?
lpolzer: f_% is a macro from f-underscore
lpolzer: you need to do an explicit replace in on-success
lpolzer: like :on-success (lambda (obj &rest args) (do-widget obj
(make-replacement-widget)))
harag: thanx
harag: lpolzer: just for curiosites sake why does the compiler not see
the yield in the on-success declaration/code
lpolzer: yield is expanded by with-flow
lpolzer: if there's no with-flow around it, it won't get expanded
harag: lpolzer: your version of on-success does not work either
lpolzer: please paste what you have now
harag: k
harag: I have two version with two different results
nunb: harag: alternatively you can try the version with the flag that i
pasted (it's the last one)
nunb: I forgot that yield converts to do-widget only inside with-flow
harag: nunb: the last one works for me
harag: but I need to understand how to use weblocks ...cleanly
harag: http://paste.lisp.org/+1XIN/1
harag: lpolzer: there it is with both versions of layout-main page
lpolzer: UNBOUND-SLOT: The slot WEBLOCKS::BASE-URI is unbound in the
object #<NAVIGATION MAIN-MENU>
lpolzer: are you running the latest dev version?
harag: lpolzer: yes
harag: the one I downloaded the other night

harag: lpolzer: did you find out why your example of login did not work
with my code?
harag: I would prefer tho use that model..like event programming...it
will make my code easier to understand for those the newbies I am
getting some time

lpolzer: harag, I did a bit of research on the unbound slot problem
lpolzer: I thought I fixed it some months ago
lpolzer: but I didn't
lpolzer:
http://bitbucket.org/S11001001/weblocks-dev/issue/6/change-in-navigation-structure-is-not-considered-on-ajax
lpolzer: in this ticket there's a link to the original discussion
lpolzer: you can read this if you want to know what the problem is
about.
harag: ok I will read it
lpolzer: I'd prefer not to fix this right now (as I did back then)
because it will likely take me at least two hours quality time.
lpolzer: the main thing is: right now I will set aside time for broken
functionality that is absolutely needed by some weblocks user.
lpolzer: but this isn't one of them I guess
lpolzer: it's not hard to work around it.
lpolzer: for example by issuing a full page reload.

- 21:48 -
harag: lpolzer: ok if I understand it correctly it is because a new page
is loaded from an ajax request (on-success) or is it just because it is
going to a new navigation(widget?) that is the issue ...and if it is the
navigation what makes it special?
lpolzer: no new page is being loaded, and that's the problem
harag: so do you loose context then?
lpolzer: a navigation has a slot named BASE-URI
lpolzer: this slot is configured on normal requests only (based on the
request uri)
lpolzer: so when you insert a new navigation into the widget tree in an
ajax req
lpolzer: it doesn't know where it will fit in
lpolzer: thus base-uri is reported as unbound
lpolzer: the main problem behind this is that an unconfigured nav won't
know what child to display
harag: what do you mean by unconfigred...not called yet?
harag: so it does not have a context ie  root to build in?

- 21:53 -
lpolzer: as I noted in the original thread we should either reconfigure
the tree on every ajax request (a bit expensive and unnecessary in most
cases)
lpolzer: or reconfigure it when we detect that a new navigation/selector
has entered the tree (optimal solution but requires some fiddling)
lpolzer: it works like this
lpolzer: we have a request uri, say /foo/bar/qux
lpolzer: no, let's make that just /foo
lpolzer: and one navigation at the toplevel that has widgets for tokens
foo, foo2, foo3
lpolzer: on a normal request to /foo the navigation will be told that
its token is "foo"
harag: thanx for taking the time to explain this by the way...
lpolzer: yw 
lpolzer: so it knows that it must display the widget matching token
"foo"
lpolzer: on an ajax request this doesn't happen at all
lpolzer: not a problem if the nav is already configured
lpolzer: but if it is newly born in the ajax request itself, it is at a
loss on what widget to display
harag: so the ajax call expects to come back to its parent structure ..?
harag: is there a way to configre the navigation without showing it
before you sue it?

lpolzer: no, that won't work
lpolzer: a navigation will be configured only if it's part of the tree.
harag: can a navigation (or views like the grid) be hidden in a page and
then just activated displayed when needed? like hiding a div
lpolzer: you could write a custom navigation that does that
lpolzer: but I don't recommend it
lpolzer: it's way easier to just do a redirect (after the login in your
case)
harag: and this is only a prolem with navigation widgets ?

- 22:04 -
lpolzer: yes
lpolzer: well, with all selectors
lpolzer: but I guess you could be a bit fuzzy and just say all
"navigations"
harag: so if I loaded a normal page from on-success it would not be a
problem something with no "navigations" or does stuff like selecting an
item in the grid fall under the same heading?
lpolzer: no, only selectors are affected.
harag: ok thanx ...
lpolzer: the problem occurs only when a selector is inserted into the
tree in an ajax request
lpolzer: these three conditions must be met.


On Wed, 2009-11-25 at 20:27 +0200, Phil Marneweck wrote:
> Ok here is the code that works for me.
> 
> http://paste.lisp.org/+1YAP
> 
> The basic rule is that you cannot make-navigation or any of its family
> in an ajax call. Weblocks does not know where it is when you do this,
> thus the base-uri error.
> 
> If you need more let me know and I will clean up the #weblocks logs ans
> post it.
> 
> 
> 
> 
> 
> On Wed, 2009-11-25 at 17:00 +0000, Rayservers wrote:
> > I have to report back... the code when ported back to my application/project
> > behaves in exactly the same way as what I wrote originally - complains about
> > base-uri and upon a refresh it works (I had not tried a refresh earlier). I
> > suspect its something to do with composite widgets. Perhaps I need to set 
> > the
> > root-composite before make-navigation gets called.
> > 
> > Cheers,
> > 
> > ---Venkat.
> > 
> > On 11/25/09 02:15, Ray Servers wrote:
> > > Hi Phil,
> > > 
> > > Yes, I ended up un-knotting myself...
> > > 
> > > http://paste.lisp.org/+1Y9O
> > > 
> > > ...has a hacked layout.lisp that gets the job done.
> > > 
> > > I will use this as a base for my next step. However I'm still not 
> > > satisfied with
> > > my comprehension of the login dialog. It should in the end, be much 
> > > simpler than
> > > this.... something like:
> > > 
> > > make navigation...
> > > 
> > > 'protected (logged-in-p
> > >                (show-protected-content))
> > > 
> > > Next step is to protect only, say the companies link.
> > > 
> > > Is there an archive of the IRC chat somewhere?
> > > 
> > > ---Venkat.
> > > 
> > > 
> > > On 11/24/09 21:54, Phil Marneweck wrote:
> > >> Hi
> > >>
> > >> I ran into the same thing on the 10th of november and the guys helped me
> > >> on the freenode irc #weblocks channel. There were various suggestions
> > >> and in the end I got poor leslie to try and explain the whys and
> > >> wherefores of the whole issue. I will not attempt relaying the
> > >> information because I will inevatably get it wrong on some level.
> > >>
> > >> I dont know if there is a online archive of the logs some where, but if
> > >> you want I can send you the log(s) of the discussion(s). There are a
> > >> couple of paste bins and other threads mentioned in the discussion that
> > >> also helps.
> > >>
> > >> Regards
> > >>
> > >>
> > >> On Tue, 2009-11-24 at 19:15 +0000, Rayservers wrote:
> > >>> I am running the -dev version of Weblocks.
> > >>>
> > >>> http://groups.google.com/group/weblocks/browse_thread/thread/51fe560b0a7cc36a
> > >>>
> > >>> is exactly where I am at. BASE-URI problems in make-navigation. Is 
> > >>> there a
> > >>> resolution? I had some permutation of my code working at some point, 
> > >>> but I
> > >>> cannot reproduce it now.
> > >>> o
> > >>> In this paste:
> > >>>
> > >>> http://paste.lisp.org/display/90095
> > >>>
> > >>> I see this code:
> > >>>
> > >>> (defun init-user-session (comp)
> > >>>   (let (proceed)
> > >>>     (with-flow comp
> > >>>       (yield #'initial-page)
> > >>>       (setf (widget-prefix-fn comp) #'render-header)
> > >>>       (yield (make-instance 'login
> > >>>                             :on-login #'authenticate-user
> > >>>                             :on-success (f_%
> > >>>                                           (setf proceed t))
> > >>>                             :on-cancel (reset-user-session)))
> > >>>       (if proceed
> > >>>           (yield (make-main-page))
> > >>>           (yield (make-login-failed-page))))))
> > >>>
> > >>> This bit -
> > >>>
> > >>> :on-success (f_%
> > >>> (setf proceed t))
> > >>>
> > >>> looks like it should be a lambda function. Compiling as-is causes it to 
> > >>> of
> > >>> course warn about an unknown function. Making it a lambda does not work.
> > >>>
> > >>> The login I wish to create is a simple form. E-mail field and one 
> > >>> button - login
> > >>> or register. It then mails a pin and presents the email field and PIN. 
> > >>> On
> > >>> success, go on to restricted content.
> > >>>
> > >>> In the process of doing this, I've got my brain tied in knots today.
> > >>>
> > >>> What is the correct way of using with-flow and friends. The function 
> > >>> yield is
> > >>> part of the with-flow construct, it seems.  The do-login 
> > >>> continuation-function
> > >>> seems to return the results of the check function. So one should use 
> > >>> either the
> > >>> do-login or the with-flow yield construct... is this right? yield 
> > >>> expects a
> > >>> widget to render. do-login says yea or nay.
> > >>>
> > >>> So can someone explain continuations... I have, of course read Slava's 
> > >>> neat
> > >>> essay http://www.defmacro.org/ramblings/continuations-web.html
> > >>>
> > >>> What I'm looking for would be in chapter 5 of the user guide... I've 
> > >>> pasted that
> > >>> onto the Wiki I created.
> > >>>
> > >>> https://freedom.rayservers.com/Weblocks+Manual
> > >>>
> > >>> I'll update that as I get along.
> > >>>
> > >>> I am also planning to use Weblocks to create a "view" of other objects 
> > >>> in
> > >>> memory. Each browser that hits the Weblocks host, gets its own widget 
> > >>> tree - its
> > >>> own view, as it were.
> > >>>
> > >>> The store magic is very cool, but I won't be using it. Snapshots onto 
> > >>> Tahoe is
> > >>> going to be the approach and, eventually a cross between Tahoe and 
> > >>> Scalaris.
> > >>>
> > >>> So the approach is going to be to write render methods and views for 
> > >>> existing
> > >>> objects...
> > >>>
> > >>> I'll stop rambling and try and ask a specific question. When to use 
> > >>> with-flow
> > >>> and when to use the do-login and friends and a couple of examples with 
> > >>> both that
> > >>> compile and work with make-navigation...
> > >>>
> > >>> Also, is there a working example of the weblocks-demo code with a 
> > >>> trivial login?
> > >>> I plan to hack that next.
> > >>>
> > >>> Cheers,
> > >>>
> > >>> ---Venkat.
> > >>>
> > >>>
> > >>>
> > >>>
> > >>
> > >>
> > > 
> > > 
> > > > 
> > 
> > 
> > > 
> 
> 
> 
> > 



--~--~---------~--~----~------------~-------~--~----~
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