[Zope] Stupid Zope-related Python Questions

James W. Howe jwh@allencreek.com
Wed, 26 Jan 2000 09:11:48 -0500


At 09:30 PM 1/25/00 -0600, Evan Simpson wrote:

>----- Original Message -----
>From: James W. Howe <jwh@allencreek.com>
> > 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?
>
>Broken Products should show a 'broken' icon in the Products page, and have a
>management tab which gives you the error message and traceback.

The product didn't have a 'broken' icon, it just didn't have any of the 
subobjects.  Normally I would have the product name and three items in the 
product which corresponded to the three ZClasses defined in the 
product.  When the python code is bad I have no ZClass subobjects and any 
instances have the broken icon.  However, I don't see a management tab 
anywhere and the source html doesn't tell me anything.  Right now the way I 
"solved" my problem is to open the python interpreter and "import" my 
python base class.  That way I can see syntax error messages.  It seems 
like there must be a better way.

> > 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?
>
>Something like...
>
>newproduct = self.manage_addProduct...
>newproduct.manage_addDTMLMethod(...)

I believe that would work for adding DTML Methods, but when I want to add 
an instance of my ZClass I do something like this in DTML code:

<dtml-call "FooClass_add(_.None, _, NoRedir=1)">

what is the equivalent Python code?  The "_" isn't understood as an 
attribute and if I replaced "_" with self then None isn't found.

Thanks for your help.

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