[Zope] Stupid Zope-related Python Questions

James W. Howe jwh@allencreek.com
Tue, 25 Jan 2000 10:40:30 -0500


I've written a ZClass which uses a Python Class as it's base.  I've written 
some DTML methods in my ZClass but I've decided to try and convert some of 
them to Python code.  I have a couple of questions relating to how Python 
works with Zope.

First, I know that when I make changes to my Python files I have to restart 
Zope to have my changes take effect.  I know that my source files get 
recompiled.  However, what I don't know is where/how I can see compilation 
error messages.  For example, yesterday I made some changes and my changes 
had some syntax errors.  I restarted the server but noticed that my Product 
didn't install correctly.  I looked and noticed that my .pyc file was 
missing.  I took a look at my source file and found a syntax error.  When I 
corrected it and restarted Zope everything worked fine.  There must be some 
way to either manually compile Python code or somehow get compilation error 
messages.  Can someone help a Python newbie with this simple task?

The other question I have concerns how to do some dtml-like functionality 
in a Python method.  In particular, how would I accomplish the same thing 
that a dtml-with tag might do?  For example, the DTMLMethod that I'm 
converting to Python is a low level instance creation method for my 
ZClass.  It is responsible for making sure the properties are updated and 
certain objects are added into the object collection maintained by my 
ZClass.  For DTMLMethods, I just call manage_addDTMLMethod.  However, I'm 
also adding an instance of another ZClass I've written, and in the DTML 
code, I have to do a <dtml-with "manage_addProduct[...]" before I call the 
add method for my ZClass.  What would be a way to accomplish this in Python 
code?

Thanks.

James W. Howe				mailto:jwh@allencreek.com
Allen Creek Software, Inc.		pgpkey: http://ic.net/~jwh/pgpkey.html		
Ann Arbor, MI  48103