[Zope] DTML-In with date/time filter

Dieter Maurer dieter at handshake.de
Wed May 3 15:28:55 EDT 2006


Martin Koekenberg wrote at 2006-5-3 14:47 +0200:
>I use this code in a Python script and call this script within a DTML-IN 
>statement. What I need is a script to get only items with a date in the 
>future, today or in the past.  The objects are DTML Documents with a date 
>property field. 

Assuming, your property contains a date, you can uses something like
(to get things with dates in the future):

   now = container.ZopeTime() # see the "DateTime" documentation for other times
   return [obj for obj in context.objectValues()
           if obj.getProperty(...) > now
	   ]

-- 
Dieter


More information about the Zope mailing list