[albatross-users] al-if and al-setarg

Alan Meadows alan.junk at sunwave.com
Wed Apr 12 04:31:38 EST 2006


Hello Albatross users,

I was trying to wrap an al-if around an al-setarg today in a template and 
ran into trouble.  Here is what I was trying to do:

<al-expand name="form">

         <al-setarg name="title">Create Additional SPF Record</al-setarg>

         <al-setarg name="desc">Enter an additional SPF records for this 
domain below.</al-setarg>

         <al-setarg name="fields">

                 <al-expand name="forminput">
                         <al-if expr="spftype == 'ip4'">
                                 <al-setarg name="label">IP 
Address/Range</al-setarg>
                         <al-else>
                                 <al-setarg name="label">Hostname</al-setarg>
                         </al-if>
                 </al-expand>

         </al-setarg>

</al-expand>

Albatross produced the following error:

HTML Traceback:

File "lib/includes/forminput", line 7, in al-macro
<al-macro name="forminput">
   File "lib/includes/forminput", line 15, in al-usearg
                 <td valign="center" align="right"><b><al-usearg 
name="label"></b></td>

Python Traceback:

File "/usr/lib/python2.4/site-packages/albatross/context.py", line 127, in 
get_macro_arg
     raise ApplicationError('undefined macro argument "%s"' % name)
ApplicationError: undefined macro argument "label"

I was able to make it work by moving the al-if higher up the chain, but I 
think the template becomes a little more redundant and harder to read:

<al-expand name="form">

         <al-setarg name="title">Create Additional SPF Record</al-setarg>

         <al-setarg name="desc">Enter an additional SPF records for this 
domain below.</al-setarg>

         <al-setarg name="fields">

                 <al-if expr="spftype == 'ip4'">
                         <al-expand name="forminput">
                                 <al-setarg name="label">IP 
Address/Range</al-setarg>
                                 <al-setarg name="input"><al-input 
type="text" name="spfdata" length="30"></al-setarg>
                         </al-expand>
                 <al-else>
                         <al-expand name="forminput">
                                 <al-setarg name="label">Hostname</al-setarg>
                                 <al-setarg name="input"><al-input 
type="text" name="spfdata" length="30"></al-setarg>
                         </al-expand>
                 </al-if>

         </al-setarg>

</al-expand>

Is there something I can do about this? Am I approaching this the wrong way?

Thanks!

Alan 




More information about the Albatross-users mailing list