On 2/25/07, Nader <[EMAIL PROTECTED]> wrote:
>
> L.S.,
>
> I have followed the book to understand who the components of TG work.
> I am at chapter 5 and I see that the save_bookmark function has
> defined with two parameters, paramerer_1 and **kwargs. The
> save_bookmark function are invoked twice in "bookmark" function, fr
> "add" or "edit".
> For "add" it is invoked with no parameter, but for "edit" with one
> parameter :
> "save_bookmark/edit/%s" % args[1]".
> I don't understand two things:
> If we request "~/bookmark/edit/1" we will get the bookmark wich has an
> ID of 1 and the value of "edit" will be compare with "args[0]". But
> what about "edit" and save_bookmark? Where in "save_bookmark" is the
> "edit" parameter has been checkek?
>
if I understood correctly it is assumed to be right.

> The second one is: how have the values of "**kwargs" been assigned in
> both functions, "bookmark" and "save_bookmark"?
>
this is a python idiom kwargs = key word arguments, the idea is that
if the caller names each parameter then the order is irrelevant, now
the beauty here is that CP actually splits the URL in this form so
when you add that you will get all other parameters from the place
your controller is mounted to the end of the path.

> Would somebody tell me about how it works. I would like to understand
> this to go on learning the rest ob chapter and the book.
>
PS: be sure to check out the turbogears-book mailing list (check out
the archive for the actual name)
PSS: also when posting questions about the book don't assume we all
have it :) some people may have the answer to your question but they
lack the complete question.

> With regards,
> Nader
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to