[albatross-users] Select tag

Daryl Houston houston at mediapulse.com
Thu Feb 13 07:18:21 EST 2003


While working on an extension of the select tag, I noted that if I
passed a nameexpr attribute, it was bombing at lines 293-4 of tags.py
and raising the error reflected in the source code below:

        if not self.has_attrib('name') and not self.has_attrib('alias'):
            self.raise_error('missing "name", "nameexpr", or "alias"
attribute')

I changed the block to:

        if not self.has_attrib('name') and not
self.has_attrib('nameexpr') and not self.has_attrib('alias'):
            self.raise_error('missing "name", "nameexpr", or "alias"
attribute')

Now my code works like a charm.  I just wanted to verify that nameexpr
was left out unintentionally and that I hadn't tried to correct
something that was left out with good reason.  Perhaps the issue is that
since select boxes pass arrays, one shouldn't be able to loop through
values to produce select boxes whose names are arrays (resulting in
arrays of arrays passed to the Web server).  Or can Albatross/standard
Web servers handle that?  If nameexpr is not an allowed param here, I
wonder if it might be a good idea to add a brief explanation to the
error, such as "nameexpr attribute not allowed in al-select tag."

I also noted that the code in question bombed even though it was listed
between <al-comment></al-comment> tags. I had the code on one system
that didn't try to parse what was between the comment tags.  This
behavior began when I moved the code to another system.  The first was
running python 2.2.1 and the second 2.2.2.  Consider the following two
nearly identical chunks of code:

<al-comment>
    <al-select name="helloABCDE">
        <al-option value="Hello"></al-option>
    </al-select>
</al-comment>

<al-comment>
    <al-select name="hello">
        <al-option value="Hello"></al-option>
    </al-select>
</al-comment>


The first raises:

File "/usr/local/lib/python2.2/site-packages/albatross/template.py",
line 63, in raise_error raise TemplateError('%s:%s: %s' %
(self.filename, self.line_num, msg)) TemplateError:
/path/to/stuff/templates/ballot.html:14: missing "name", "nameexpr", or
"alias" attribute 
The second works like a charm. Is this possibly a python version issue?
Thanks,
D



=====================
Daryl L. L. Houston
Software Developer/E-commerce Specialist
Mediapulse, Inc.
800.380.4514
865-482-4455 ext. 21





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.object-craft.com.au/pipermail/albatross-users/attachments/20030212/2371aa40/attachment.html>


More information about the Albatross-users mailing list