folder.objectValues() help
I would like to get back a list of objects, from a folder that have a parameter checked off in them: So, I would like to get back a list of items "Item Name" that also have been approved (check box value) These do not work: <dtml-in "folder.objectValues('Item Name') and approved" size="3"> <dtml-in "folder.objectValues('Item Name' and approved)" size="3"> This works: <dtml-in "folder.objectValues('Item Name') reverse size="3"> <dtml-if approved> But would not show three, if one was not approved. I know it is some little snipped I am missing.. BZ
--On Montag, 18. August 2003 13:10 Uhr -0500 BZ <bz@bwanazulia.com> wrote:
I would like to get back a list of objects, from a folder that have a parameter checked off in them:
So, I would like to get back a list of items "Item Name" that also have been approved (check box value)
These do not work: <dtml-in "folder.objectValues('Item Name') and approved" size="3"> <dtml-in "folder.objectValues('Item Name' and approved)" size="3">
There is no documentation that shows such a syntax. So why do you assume that this should work?
This works: <dtml-in "folder.objectValues('Item Name') reverse size="3"> <dtml-if approved>
Use the ZCatalog and create a PathIindex and a FieldIndex for 'approved' and then rephrase your problem using a ZCatalog search. -aj
BZ wrote:
I would like to get back a list of objects, from a folder that have a parameter checked off in them:
So, I would like to get back a list of items "Item Name" that also have been approved (check box value)
You can use list comprehensions to do this (untested): <dtml-in "[item for item in folder.objectValues('Item Name') if item.approved]"> </dtml-in>
That worked like a charm.... (two charms, since I used it in two places). Thanks very much. BZ
BZ wrote:
I would like to get back a list of objects, from a folder that have a parameter checked off in them:
So, I would like to get back a list of items "Item Name" that also have been approved (check box value)
You can use list comprehensions to do this (untested):
<dtml-in "[item for item in folder.objectValues('Item Name') if item.approved]">
</dtml-in>
_______________________________________________ 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 )
participants (3)
-
Andreas Jung -
BZ -
Kevin Carlson