[Zope] ZRoundup?

Chris Withers lists at simplistix.co.uk
Tue Mar 16 04:00:53 EST 2004


Tim Couper wrote:
> possible in Zope to separate the various elements of
> web apps in general 

Depends on what you see as the various elements of web apps in general ;-)

> the content side, and I'd like to have the app in
> python, with a Zope "front end",

Ah, you'll be wanting Zope 3 then ;-)
(if such a beast ever stops morphing its implementation every 2 days...)

> being shown here. So if I'm developing a python app
> for the web, I can put all the functionality in, say,
> the App class, and have a ZApp class as front-end
> which inherits all the functionality from App by
> subclassing,

No, no, subclassing is bad. Most people prefer to approach this with 
component-type solutions, which I hope Zope 3 is still using.
The idea is you have your python class that does what it wants, say a python 
email.message, and then write adapters as necessary to make it do what you want. 
I think ZODB persistence is the only thing which doesn't work this way in ZOpe 
3. Anyway, aside from that you can use any python module/class you want without 
hav ing to subclass it and worry about who inherited what from whom...

Sadly, in Zope 2, you need to subclass and mix-in the stuff you need, OFS.Folder 
or OFS.SimpleItem usually cover the bulk of it, but they bring loads of baggage 
with them.

> The only fly-in-the-ointment I've found to date is
> that writing a Zope app with an RDBMS from scratch I'd
> probably want to use ZSQLMethods (as the framework
> handles them "naturally") and so the python App class
> has to know about it's frontend and the elegance goes
> away. 

Hurm, maybe it just needs to be agnostic about what it's backend is here?

For example, your class may have a "getData" method, this may raise 
NotImplemented or may load data from a file in the pure Python version, in the 
Zope subclass it may look like:

def getData(self):
    return self.my_zsql_method_in_my_containing_folder()

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




More information about the Zope mailing list