[Zope-dev] SkinScripts instantiating new objects

Stefan Karlsson stefan@everynet.se
Fri, 16 Feb 2001 12:59:01 +0100


Hi,

I want my SkinScript to instantiate a new object of type ProjektHandler
and put it into an attribute called projekt. For this I have created
an external method, returning a new object of type ProjektHandler (simplified):

def getNewProjektHandler(self, parentId, parentClass):
    h = ProjektHandler()
    return h

The skinscript look like this:
WITH self.getNewProjektHandler(self.id, 'Projektagare') COMPUTE projekt=RESULT

This works if I call it from python, e. g
print self.mySpecialist.getItem('foo').projekt

But it does not work when I call it from the web, e. g
http://server/mySpecialist/foo/projekt (see the traceback from the log file below)

Has anyone an idea why this doesn't work?

Zope 2.3.0b2
ZPatterns 0.4.3b1

/Stefan Karlsson


------
2001-02-16T11:28:35 PROBLEM(100) ZPatterns Error computing attribute projekt
Traceback (innermost last):
  File /home/stefan/myzope/zope2/lib/python/Products/ZPatterns/AttributeProviders.py, line 311, in _
AttributeFor
    (Object: GAPMixin)
  File Products/ZPatterns/Expressions.py, line 122, in eval
  File DocumentTemplate/DT_Util.py, line 336, in eval
    (Object: self . getNewProjektHandler ( self . id , 'Projektagare'  ))
    (Info: self)
  File <string>, line 0, in ?
  File DocumentTemplate/DT_Util.py, line 140, in careful_getattr
AttributeError: getNewProjektHandler