[Twisted-web] Re: Re: new nevow know-how needs...;-)

James Y Knight twisted-web@twistedmatrix.com
Sat, 6 Mar 2004 16:49:49 -0500


On Mar 6, 2004, at 3:57 PM, Stephen Waterbury wrote:
> Aren't you confusing variable names with values?  I would think
> what you cite here would only be a problem if what was called
> "usernames" was later called "title" -- which would be a problem
> in any event.


No -- given a page with the following functions:

def data_users(context, data):
   return {'foom': 'James Knight", 'mg': 'Matt Goodall', 'title': 'Bogus 
User'}
def data_title(context, data):
   return "My Title"

You ask it to render this:
<span data="users"><span data="title">.....</span></span>

First, it will lookup the child 'users' from the current data (the Page 
instance). This will be the function data_users, which will be called, 
and return the dictionary. Now, the current data is the abovementioned 
dict. Now, it looks up the child 'title' from the current data (the 
dict). This will return 'Bogus User', which is not at all what you 
wanted!

James