[ZPT] ZPT->script->ZPT rendering problem

alan milligan alan_milligan@hotmail.com
Mon, 25 Feb 2002 00:31:41


Hi,

I'm a bit new to Zope, and am struggling with an inconsistency I do not 
understand.

I have a ZPT that calls a python pcript with the request, that calls an 
external method with the request, which calls another ZPT with the request 
to display output.

The last ZPT independently renders correctly, It works when the external 
method independently invokes it, and it works via the python script external 
method invokation.  However, when the ZPT invokes the python script, all 
that is output is a portion of the unrendered stylesheet which is embedded 
in a page macro dragged into the ZPT.

What is even more intriguing is that the initial ZPT constitutes two forms 
with this programming style, and the second form always renders properly!

At this stage, the only useful thing I can do is provide some code stubs.

I have found that removing the external method from the chain still exhibits 
broken behaviour, so have not included this element here.  I also have no 
cause to be suspicious of any of my macro definitions which appear to work 
well in other places.

Sorry, that this email is a bit shite, but I really need a solution or at 
least some suggestions regarding how I can discover more about the Zope 
processing model in relation to this.

Cheers, Alan

ZPT 1 (key_server) :
#######################################################################################
<html metal:use-macro="container/standard_template.pt/macros/page">
    <div metal:fill-slot="body">

<table tal:condition="request/form/error | nothing">
    <table metal:use-macro="container/standard_template.pt/macros/error">
       <div metal:fill-slot="body" tal:content="request/form/error">Error 
Here!!</div>
    </table>
</table>


<table tal:condition="request/form/info | nothing">
    <table metal:use-macro="container/standard_template.pt/macros/info">
       <div metal:fill-slot="body" tal:content="request/form/info">Info 
Here!!</div>
    </table>
</table>

<h2>Find A Key</h2>
Construct your query here.  Any attribute <i>not</i> containing a value,
will be excluded from the query.
<form action="ldapsearch">
   <table cellpadding="0" cellspacing="0">
      <tr><td></td>
          <th>Name</th>
          <td><select name="name_operator">
                  <option>contains</option>
                  <option>is</option>
                  <option>isn't</option>
                  <option>begins with</option>
                  <option>ends with</option>
              </select>
           <input type="text" name="name_value" size="20"></td>
      </tr>
      <tr><td><select name="email_conjunction"><option>and</option>
                                            
<option>or</option></select></td>
          <th>Email</th>
          <td><select name="email_operator">
                  <option>contains</option>
                  <option>is</option>
                  <option>isn't</option>
                  <option>begins with</option>
                  <option>ends with</option>
              </select>
              <input type="text" name="email_value" size="20"></td>
      </tr>
      <tr><td><select name="org_conjunction"><option>and</option>
                                          <option>or</option></select></td>
          <th>Organisation</th>
          <td><select name="org_operator">
                  <option>contains</option>
                  <option>is</option>
                  <option>isn't</option>
                  <option>begins with</option>
                  <option>ends with</option>
              </select>
              <input type="text" name="org_value" size="20"></td>
      </tr>
      <tr><td><input type="submit" value="Search"></td></tr>
   </table>
</form>

<h2>Add Your Key</h2>
Simply fill in all of the form fields and paste your key into the textarea.  
The key should be
an armoured MIME format.
<form action="ldapadd">
   <table>
      <tr><td><b>Name</b><input type="text" name="name" 
size="20"><b>Email</b><input type="text" name="email" size="20"></td></tr>
      <tr><td><b>Organisation</b><input type="text" name="org" 
size="40"></td></tr>
      <tr><td><textarea name="key" rows="10" cols="50"></textarea></td></tr>
      <tr><td><input type="submit" value="Add"></td></tr>
   </table>
</form>

    </div>
</html>

################################################################

### ldapsearch script ####

# Import a standard function, and get the HTML request and response objects.
from Products.PythonScripts.standard import html_quote
request = container.REQUEST
RESPONSE =  request.RESPONSE

#request = context.searchKey(request)

#if request.form.has_key("error"):
#return container.key_server(request)

return container.key_server_results(request)


###############################################################
ZPT 2 key_server_results

<html metal:use-macro="container/standard_template.pt/macros/page">
    <div metal:fill-slot="body">

<h2>Key Server Query</h2>
<b>Filter: </b><span tal:condition="request/form/filter | nothing">
	            <b tal:content="request/form/filter">filter</b>
               </span>
<span tal:condition="request/form/results | nothing">
    <p tal:content="request/form/results">the results are here</p>
</span>
<span tal:condition="not:request/form/results | nothing">
    <p>Sorry, no entries matched your filter.</p>
</span>

    </div>
</html>




_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx