[Zope] ZopeFind & obj_searchterm & obj_expr
Oliver Bleutgen
myzope@gmx.net
Wed, 31 Oct 2001 19:17:32 +0100
Oliver Erlewein wrote:
> Hi
>
> I want to find Objects with certain values. Momentarily I use this
script:
>
> -- till=7, datum is a property of the Object Forumbeitrag! --
>
> <dtml-call "REQUEST.set('Ztime', ZopeTime()-till)">
> <dtml-call "REQUEST.set('result', ZopeFind(this(),
> obj_metatypes=['Forumbeitrag'], obj_mtime=Ztime, search_sub=1))">
> <dtml-if result>
> <h2>New comments the last &dtml-till; days:</h2><br>
> <table border=0 cellpadding=2>
> <dtml-in result sort=datum reverse>
> <dtml-if "datum >= (Ztime.Date()+' '+Ztime.Time())">
> <tr><td><dtml-var title></td></tr>
> </dtml-if>
> </dtml-in>
> </table>
>
> Now, as you can see it is quite complicated. How do I get the
evaluation of
> "datum >= (Ztime.Date()+' '+Ztime.Time())" into the ZopeFind command?
>
You now of bobobase_modification_time?
But you can replace it anyway, I just copied and pasted from existing code:
<dtml-in "ZopeFind(this(), obj_expr='bobobase_modification_time() >=
ZopeTime()-1')">
combine that with the various dtml-in variables (sequence-start/end/)
and dtml-else and you'll indeed can shrink your code somewhat.
cheers,
oliver