On Thu, 2003-11-13 at 12:01, Max M wrote:
> I have a piece of code that looks like below. It has worked for a few 
> years now. After upgrading to 2.61 it doesn't any more.
> <input type="hidden" name="teachers:list:default" value="">
> <dtml-call "REQUEST.set('teacherList', getAllTeachers())">
> <dtml-in teacherList sort=title>
>          <input type="checkbox" name="teachers:list"
>             value="<dtml-var path>"<dtml-if selected> checked</dtml-if>>
>          <a href="<dtml-var path>/manage_main">&dtml-title;</a><br>
> </dtml-in>
> I have tracked the problem to the default value always being added to 
> the "teachers" list.
> meaning that my action method:
> def addTeacher(self, teachers):
>       print teachers
>  >> ['some/path', '']
> Where I would expect:
>  >> ['some/path']
> Isn't that a new behaviour? And isn't it a bug?

Can you double check that it is actually the default value, and not a
trailing empty line (I'm guessing that you are posting to 'addTeacher'
from a form with a control like:  '<textarea

E.g, change the 'teachers:list:default' value to some other string, and
see if that value propagates.

Either way, as a robustness measure I would recommend adding some input
checking to 'addTeacher', e.g.:

    def addTeacher( self, teachers ):

        """ Add one or more teachers.
        teachers = filter( None, teachers ) # strip empty lines
        # your processing here

Tres Seaver                                [EMAIL PROTECTED]
Zope Corporation      "Zope Dealers"       http://www.zope.com

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to