[albatross-users] al-input and id

Andrew McNamara andrewm at object-craft.com.au
Sat Feb 18 00:45:28 EST 2006


>> Recent versions of Albatross let you do exactly that (if you're not
>> already using 1.33, I suggest you download that anyway).
>
>I'm using 1.33-2 version of Debian/Sid. It does not work.
>
>I had a look a /usr/lib/python2.3/site-packages/albatross/tags.py and
>there is no reference do "idexpr" in the Input class.

No, it's "magic" - the attribute handling in the Input class is for the
classic al-input attributes. The code that allows any attribute to be
the product of an expr is in the write_attribs_except() method of the
template.Tag class.

>What I am doing wrong ?

I'm not sure - to check I wasn't deluding myself, I tried it myself and got
the expected result:

    1$ python
    Python 2.3.5 (#2, Aug 30 2005, 15:50:26)
    [GCC 4.0.2 20050821 (prerelease) (Debian 4.0.1-6)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import albatross
    >>> albatross.__version__
    '1.33'
    >>> ctx = albatross.SimpleContext('.')
    >>> ctx.locals.names = ['Alex', 'Fred', 'Guido', 'Martin', 'Raymond', 'Tim']
    >>> albatross.Template(ctx, '<magic>', 
    ...        '<al-input name="foo" idexpr="names[0]">').to_html(ctx)
    >>> ctx.flush_content()
    <input id="Alex" name="foo" />

-- 
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/



More information about the Albatross-users mailing list