[Zope] syntax or namespace problem

notices notices@fiberfolk.com
Wed, 24 Apr 2002 06:42:52 -0700 (PDT)


Hi. I'm having a wonderful time with zope for the most part,
 but here is my snag. I can't seem to access a variable 
in the request called badsearch from DTML.

I have a script named getCatalogpy that returns search results in a catalog, 
and if the number of results is too small, it sets a flag like so-

(first)
request = container.REQUEST
request.set("badsearch","false")

(then later on)
found = container.np.phone.phoneCatalog()
        if len(found)>= mingoodsearch:
            return found
        request.set("badsearch","true")    

I can get badsearch from my Page Template for Results, like so.

<body tal:define="results here/getCatalogpy;
                    start request/start|python:0;
                    searchby request/searchby;
                    searchtext request/searchtext;
                    badsearch request/badsearch;
                    batch python:modules['ZTUtils'].Batch(results, 
                                                          size=10, 
                                                          start=start);
                    previous python:batch.previous;
                    next python:batch.next"> 


then it's used here:

<span tal:condition="python:(badsearch=='true')">We find no matches. Here is the entire list.<br></span>

so far, so good. But I also have a results page for WAP/WML browsers that uses the same script. 
It's done in DTML because a Page Template has to be good HTML, which WML is not.

I want something like 

<dtml-if "badsearch == 'true'">
We find no matches. Here is the entire list.<br />
</dtml-if>
 
but Zope can't find badsearch. It must be in the request, because the Page Template can find it after the script.
I tried request/badsearch and a number of syntax variations. 

Thank you very much for your assistance,
Annie