[Zope-dev] SkinScripts instantiating new objects

Steve Alexander steve@cat-box.net
Fri, 16 Feb 2001 13:31:43 +0000


Stefan Karlsson wrote:

 > Hi,
 >
 > I want my SkinScript to instantiate a new object of type
 > ProjektHandler and put it into an attribute called projekt.

In your example, there is no sense of the ProjektHandler instance being 
saved persistently in the attribute. A new object is created for each 
transaction. Is this what you want?

 > For this I have created
 > an external method, returning a new object of type ProjektHandler

Where have you put this external method? That is, where in the ZODB?


 > 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

That's as I expect. Generally, you call methods from URLs, you don't 
retrieve the values of attributes.



--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net