On Mon, 29 Jan 2001, Timothy Wilson wrote:
On Mon, 29 Jan 2001, Tres Seaver wrote:
I'd like to grab all instances with a display_date <= today's date. I can't figure out exactly how to do that in DTML or a Python Script. Once I have that list of instances, I'll simply pull off the latest one as you suggested.
I don't know where it would be in the book it would be, but I do this something like::
<dtml-in expr="theCatalog( meta_type='Photo' , display_date=ZopeTime() , display_date_usage='range:max' , sort_on='display_date' , sort_order='reverse' )">
The expression would be basically the same in a PythonScript::
return context.theCatalog( meta_type='Photo' , display_date=ZopeTime() , display_date_usage='range:max' , sort_on='display_date' , sort_order='reverse' )
Great! The first DTML example works perfectly. The second, however, throws up an error. In fact, I have yet to figure out how to use ZopeTime() in a PythonScript. Do I have to pass anything in?
I get:
Error Type: NameError Error Value: ZopeTime
when I try it.
Oops! ZopeTime is acquired from the application object; in a PythonScript, it should be called via the 'context' binding: context.ZopeTime()
Thanks again. I should have those pictures up in no time.
Great! Tres. -- =============================================================== Tres Seaver tseaver@digicool.com Digital Creations "Zope Dealers" http://www.zope.org