[Zope] Newbie - ZCatalog expression from REQUEST object?

Charlie Reiman creiman@kefta.com
Fri, 5 Jul 2002 14:50:35 -0700


It is indeed a commonly asked question. It comes in many flavors. The answer
is you cannot expand dtml tags within dtml tags. So stuff like:

<dtml-in expr="...<dtml-var other>">

won't work because the expression in quotes is python code, not DTML. You
can still get to your data. Try

<dtml-in expr="....com_search=_['searchterm']...">

> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
> Lonnie Maynard
> Sent: Friday, July 05, 2002 2:25 PM
> To: zope@zope.org
> Subject: [Zope] Newbie - ZCatalog expression from REQUEST object?
>
>
> I have what is quite probably a stupid newbie question and apologize in
> advance. I have configured a ZCatalog with custom indexes and
> wish to do a
> relatively simple search on that catalog via the code below.
>
> <dtml-in expr="Catalog(start_date=ZopeTime(),
>               start_date_usage='range:max',
>               end_date=ZopeTime(),
>               end_date_usage='range:min',
>               com_search='<dtml-var name=searchterm>'
>               )">
>
> start_date is used to limit returned items to those that have a
> start_date
> earlier than today, end_date is used to limit returned items to
> those that
> have an end_date later than today. Both of those work. My issue
> is passing
> the Request object searchterm. It is in the namespace, as I can
> show the var
> above the dtml-in line.
>
> I have tried 1.   <dtml-var searchterm>
>             2.  <dtml-var name="searchterm"> (I get invalid
> attribute name)
>             3.  <dtml-var name=searchterm>
>
> 1 and 3 return no results, and #2 gives me invalid attribute
> name. It looks
> as if I have bad syntax but I do not know where. Any help would
> be greatly
> appreciated. Thanks in Advance.  Lonnie Maynard
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>