[Zope-CMF] Re: CMF Zope Products: Python versus ZClass

Carl Rendell cer@sol43.com
Sun, 12 May 2002 10:44:36 -0700


> Hi,
>
> I'm looking at building a CMF Zope Product w/ python
> but am finding very little documentation regarding
> this.
>
> There is an example in the ZDG w/ caveat regarding CMF
> interface and no clues [links].
>
> There are examples of building both Components and Products
> using ZClass methods.
>
>> From a newbies perspective, it looks like python is only for
> "insiders" and there is virtually nothing in CMF that has a
> lot to say about python.
>
> Is this a fair assessment?
>
> What if I build a complex product using ZClass? What are the
> Pro's and Con's compared to building with python if I figure
> out how?
>
> --
> Jeffrey L. Franks  (Web)  http://www.motiftools.org
>                    (Mail) jfranks@quik.com
>

Having just completed the journey to answer that question - should 
I use ZClasses or python products? - I can offer some of what I 
experienced.

As I found out, ZClasses provide a simple way to develop new 
'products', but they have the drawback of making distribution of 
these products difficult. There are also issues of extensibility 
which come up from time to time. Both of these points were 
explained to me by Tres Seaver at Python 10 this year. - thanks 
Tres!

On the other hand, python based products can be daunting to try 
because there is a lot involved, especially if you want to have 
your products 'play nice' with CMF.

That said, I've converted to creating new 'products' with python 
mainly for reasons of distribution and extensibility. In the long 
run it is more productive and stable. When taking the python based 
route there are two paths to follow:

   1. create products derived from current CMF products (i.e. News 
derived from Document).

   2. create 'new products' that are dependent (inherit from) upon 
Zope, but independent from CMF.

Circumstances will dictate which, and there is a third option - 
straight python - but as someone pointed out in the list, going 
straight python in essences creates a new 'branch' in the code for 
you to support. I stick with either 1 or 2 for my products.

Figuring out how.. there are quite a few how-to's out there, and 
I've found that looking at products created by others or products 
in CMF demonstrate how to do things. My favorites are:

CMFDefault - News.py : illustrated leverage from an existing 
product (in this case document) to create another product.

CMFEmployment - this product (available on zope.org) demonstrates 
some of the principles of registration with CMF like adding skins, 
portal types, and what have you.

Of course you can look at any of the CMFCore or CMFDefault products 
to see how those have been put together as well. Tres Seaver's 
FSDump product has proven useful in understanding functioning 
ZClass based products as a prelude to writing it out in python:

http://www.zope.org/Members/tseaver/FSDump

Hope that helps you,

~C

Carl E. Rendell
Solution43
Information Distribution Consulting        |   "Ahhhh the power of
cer@sol43.com                              |    acquisition"  - Chef Z