[Zope] inheritance and ZClasses

Jeffrey Shell Jeffrey@digicool.com
Sat, 17 Jul 1999 11:49:29 -0400


Names beginning with underscores (with the exception of the _ namespace
itself) are illegal in DTML Scripting.  This is part of the security
design.

Instead, you can write an External Method for use in your ZClass
"constructor" to do this.

> -----Original Message-----
> From: Alex Rice [mailto:alrice@swcp.com]
> 
> When using my own python classes as base classes for 
> ZClasses, I want to
> handle constructors. So, I figured I would add:
> 
> <!--#call "baseClass.__init__(self,...)"--> 
> 
> after the #with ... createInObjectManager() in my ZClass "constructor"
> dtml method.
> 
> But, Zope takes issue with that method name when I commit the dtml,
> raising a TypeError. Is there a way to call constructors from dtml
> methods or elsewhere in ZClasses? Other inherited methods (other than
> constructors) give me no troubles. Here is the traceback:
> 
> ...
>  File 
> /usr/share/Zope-2.0.0a4-src/lib/python/DocumentTemplate/DT_Var.py,line
> 307, in __init__ 
>  File 
> /usr/share/Zope-2.0.0a4-src/lib/python/DocumentTemplate/DT_Uti
> l.py, line
> 337, in name_param
>     (Info: ({'': '"baseClass.__init__(self)"'}, 'call', 1, 'name'))
>  File 
> /usr/share/Zope-2.0.0a4-src/lib/python/DocumentTemplate/VSEval
> .py, line
> 167, in __init__
>     (Object: baseClass.__init__(self))
> TypeError: illegal name used in expression
> 
> Thanks for any advice on this,
> 
> -- 
> Alex Rice    |    alrice@swcp.com    |    http://www.swcp.com/~alrice
>     Current Location: N. Rio Grande Bioregion, Southwestern USA
>