[Zope-dev] SkinScripts instantiating new objects

Steve Alexander steve@cat-box.net
Fri, 16 Feb 2001 15:21:32 +0000


Stefan Karlsson wrote:

> 
> BTW is it possible to save the ProjektHandler instance persistently
> in the attribute? Is there an easier way than creating a separate
> specialist for the ProjektHandler class and storing the instances there?

I think you're getting design and implementation confused here.

Should ProjektHandlers be a Dataskins? If so, they should live in their own Rack.
Or, does a ProjectHandler really belong as a part of the instance of something else?
In this latter case, you could add a ProjectHandler as an attribute.
As to whether this is a wise thing to do; well, I can't say, as I don't know what problem you're trying to solve.

If you want to store ProjektHandlers as attributes of a persistent class, just add them, using a method of your base Python class, or an External Method.
In this case, you'll almost certainly want to define the ProjektHandler class in a Product, and not in an External Method.

 
>> That's as I expect. Generally, you call methods from URLs, you don't 
>> retrieve the values of attributes.
> 
> So, what do you suggest, should I implement __bobo_traverse__ or
> something in foo to make the URL work?

Yes.

For example, make projekt a method rather than an attribute. Or, have a getProjekt method.

I'd like to offer some advice, but please don't take this the wrong way; I mean it respectfully.
You seem to be trying to design your application using SkinScript and External Methods and Specialists.
I suggest first designing the application on paper, then implementing it using SkinScript, Specialists and so forth.

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