[Zope] get objects "DTML Document" having Property "order"...

Shane Hathaway shane@digicool.com
Tue, 30 May 2000 11:28:06 -0400


"QUIN Frédéric" wrote:
> 
> Hello,
> 
> I want to do :
> <dtml-in "objectValues('DTML Document')" sort=order>
> ...
> </dtml-in>
> 
> I have some DTML Documents which don't have the property "order", and I
> don't want to consider those documents in my loop. But if I put the
> "sort=order" option, Zope raises an error
> 
> How can I do ???

Here's a convoluted hack (untested).  I wonder if anyone can come up
with a better way.

<dtml-let values="objectValues('DTML Document')" filtered="[]">
  <dtml-in values>
    <dtml-if order>
      <dtml-call "filtered.append(_['sequence-item'])">
    </dtml-if>
  </dtml-in>
  <dtml-in filtered sort=order>
    ... your code here ...
  </dtml-in>
</dtml-let>

... but the version of Zope in the CVS repository already has a change
that makes it so the sorting code will consider fields that don't exist
to have the value "None".  This makes it so you can sort the natural
way.

Shane