[albatross-users] setting value field

Matt Goodall matt at pollenation.net
Wed Jun 25 19:51:06 EST 2003


Eric S. Johansson wrote:

> Michael C. Neel wrote:
>
>> As for setting values in an al-input; you don't need to do anything.  If
>> ctx.locals.name = 'Mike', and your tag is <al-input type="text"
>> name="name"> albatross will write out <al-input type="text" name="name"
>> value="Mike">.
>
>
> so you are saying that the value of the name used for the name field 
> is applied to the value field.

Yes, in its simplest form it simply looks up the value in the ctx.locals.

> It's marvelously simple and quite intuitive once you know it's there!! 

Lovely isn't it :). The simplicity of the really common (and often 
tedious) stuff is one of the things that made me look at Albatross.

> is this documented anywhere?  I would love to know where my brain 
> skiped the groove. 

It is, although it took me a while to find it again ;-). The 2nd 
paragraph of section 5.2.2 is the important bit; "execution context" 
simply means ctx.locals here.  To summarise, it goes something like this:

   1. if the 'expr' attribute is present then evaluate the expression
      and use the result as the value
   2. else if the 'value' attribute is present then use it as the value
   3. else use the 'name' attribute to look up the value in the ctx.locals

Don't forget that the code is all there on your disk and most of it is 
very simple to read. FYI, all the HTML tag support is in tags.py, just 
search for 'al-input' or 'al-for' etc to find the code. Isn't open 
source wonderful :).

-- 
Matt Goodall, Pollenation Internet Ltd
e: matt at pollenationinternet.com
t: 0113 2252500





More information about the Albatross-users mailing list