You are going to have to loop thru the documents and use 'getProperty' to access the date property field on the document. Then you will need to compare the date value (the Zope Book V2.6 has a good description of dates/time usage) to see if it is in the range you need. You could use a python script to do this loop/compare and return a list of document ids which you could then display via your DTML-in stmt.

If you have a lot of documents this could be a very expensive approach. You might want to have a look at ZCatalog.



----- Original Message ----- From: Martin Koekenberg
Sent: Wednesday, May 03, 2006 8:47 AM
Subject: Re: [Zope] DTML-In with date/time filter

Hello Andreas,
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.


Martin Koekenberg

-----Original Message-----
From: Andreas Jung <[EMAIL PROTECTED]>
To: Martin Koekenberg <[EMAIL PROTECTED]>,
Date: Wed, 03 May 2006 12:20:33 +0200
Subject: Re: [Zope] DTML-In with date/time filter

--On 3. Mai 2006 12:17:36 +0200 Martin Koekenberg

I can create a dtml-in filte with the following code:

return [doc for doc in context.objectValues('DTML Document')  if

Using "return" in DTML does not make sense. Writing such code in DTML
is bad-style. Use Pythonscript for this code and call the script from
DTML (btw. better user ZPT).

How can I do the same with a date or time ?

What does that mean?


ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany
Web: - Email: [EMAIL PROTECTED] - Phone +49 - 7071 - 793376
E-Publishing, Python, Zope & Plone development, Consulting

Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )
Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to