[Zope] DTML namespace problem (was: dtml-tree issue)

Tino Wildenhain tino at wildenhain.de
Mon Apr 11 07:42:25 EDT 2005


Hi,

Am Montag, den 11.04.2005, 14:08 +0300 schrieb Vangelis Mihalopoulos:
> 
> Andreas Jung wrote:
> 
> > You should *not* define classes inside PythonScripts. PythonScripts 
> > are stricted
> > and don't provide the full functionality. Either use filesystem based 
> > code (Zope
> > Product) or use simple Python datatypes as dictionaries in this case.
> 
> 
> An External Method behaves exactly the same. I have not yet involved in 
> writting even the simpler Product and i will not do it now for such a 
> trivial issue.
> 
> I tried to return a dictionary,
> -----  return {'a':1, 'b':2, 'c':3}  ------
> but it the DTML Doc fails with a KeyError.

Use a dict and if you really need DTML... see the keyword
"mapping" for <dtml-with> and <dtml-in> tags.

If you want to return custom class objects into untrusted
code (e.g. from external methods) you need to set security
declarations on them - at least add the attribute:

__allow_access_to_unprotected_subobjects=1 

(from top of head - just grep -r zopes source
for the actual name)

HTH
Tino



More information about the Zope mailing list