[Zope] "Picture of the day" product

Timothy Wilson wilson@visi.com
Mon, 29 Jan 2001 22:43:14 -0600 (CST)


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.

-Tim

> Hope that helps!

Thanks again. I should have those pictures up in no time.

-Tim

--
Tim Wilson      | Visit Sibley online:         | Check out:
Henry Sibley HS | http://www.isd197.k12.mn.us/ | http://www.zope.org/
W. St. Paul, MN |                              | http://slashdot.org/
wilson@visi.com |   <dtml-var pithy_quote>     | http://linux.com/