[Zope] "Picture of the day" product
Jim Washington
jwashin@vt.edu
Tue, 30 Jan 2001 08:03:53 -0500
Hi, Tim
context.ZopeTime()
or
container.ZopeTime()
ZopeTime is not in the PythonScript's namespace. It is available in
most (all?) containers, however.
-- Jim Washington
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.
>
> -Tim