[Zope] Newbie Q: How do I cal ZPT objects from a python script object?

Joe Block jpb at apesseekingknowledge.net
Mon Dec 6 14:36:45 EST 2004


I'm running Zope 2.6.3 on Mac OS 10.3.6 (installed via fink).

I'm trying to call a very simple page template from inside a python  
script object to display a message (in this case, the results of a  
database insert).

Here's my results page template:
<html>
<head>
	<title tal:content="template/title">The title</title>
	<style type="text/css">
  		@import "/octavo/css/style.css";
	</style>
</head>
<body>

<p><span tal:replace="request/msg">msg</span></p>

<div align="center">
<p>Logged in as <span tal:content="user/getUserName">User</span></p>
</div>
</body>
</html>

If I type the template's URL into a browser  
(<http://athena.local.:8080/octavo/trackart/results? 
msg=Foo%20bar%20baz>), it displays Foo bar baz as expected. I just  
can't call the template from within my python script, when I try I get  
the following error message

Zope Error

Zope has encountered an error while publishing this resource.

Error Type: KeyError
Error Value: msg

I'm calling it from within the script object like so:

	msg = '%s added to client %s' % (job_id, clientname)
	return container.results(msg = msg)

The script is in the same folder as the results template.

I know there has to be something simple I'm missing, but I've banged my  
head against the wall for a while and haven't made any progress.

jpb
-- 
Joe Block <jpb at ApesSeekingKnowledge.net>

Computer Science is about lofty design goals and algorithmic  
optimization. System Administration is about cleaning up the resulting  
mess.



More information about the Zope mailing list