[Zope] sequence / int handling (DTML)

Dylan Reinhardt zope@dylanreinhardt.com
24 Jun 2003 17:33:41 -0700


To test if place is a sequence, try:

<dtml-if "_.hasattr(place, 'sort')">

HTH,

Dylan

On Tue, 2003-06-24 at 16:33, David Siedband wrote:
> I have a DTML page where users can choose location(s) to link to a 
> hypothesis.  So there's an HTML multiple selection field.  I have code 
> that calls SQL to insert multiple selections and code that calls the 
> SQL insert for a single entry.  My question is how do get Zope to 
> differentiate between the two scenarios and use the appropriate code.  
> It's some sort of <dtml-if >  logic...
> 
> This tag calls the SQL query to inset a single selection
>        <dtml-call "queries.updateHypPlace()">
> 
> This code iterates through the sequence and calls the SQL to insert 
> each one
>      <dtml-in place prefix=obj>
>        <dtml-call "queries.updateHypPlace(place=obj_item , huid=hid)">
>      </dtml-in>
> 
> What I have in mind is
> 
> <dtml-if ????>
>      <dtml-call "queries.updateHypPlace()">
> <dtml-else ????>
>      <dtml-in place prefix=obj>
>        <dtml-call "queries.updateHypPlace(place=obj_item , huid=hid)">
>      </dtml-in>
> </dtml-if>
> 
> Suggestions?
> 
> TIA,
> 
> David
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )