[Zope] Z Classes Tutorial: Rough Draft

Michel Pelletier michel@digicool.com
Fri, 7 May 1999 14:46:35 -0400


> -----Original Message-----
> From: Jordan B. Baker [mailto:jbb@spyderlab.com]
> Sent: Friday, May 07, 1999 2:20 PM
> To: Amos Latteier
> Cc: zope@zope.org
> Subject: Re: [Zope] Z Classes Tutorial: Rough Draft
> 
> 
> Hi Amos:
> 
> I just stepped through the tutorial.. its great!
> 
> One minor thing to add is how to add the the index_html method to the
> ZClass (it doesn't say you need to go into the Methods tab) 
> and also how
> you can configure it so that it gets a view tab if you want.
> 

Managment tabs are created in the 'Views' tab of the ZClass.  There, you
can bind ZClass methods to tabs.  If you want a 'View' tab in the
instances of your ZClass, bind 'index_html' to 'View'.


> The ZClasses are going to really change a lot of things with how most
> Zope projects are implemented I would think.

Absolutely.

> One issue I'm 
> interested in
> that you'll probably address fairly soon is how to migrate 
> existing code
> to the ZClasses framework.  I would assume you can place 
> External Methods
> into the Methods area of the ZClass?

This is one way, but can be rather difficult if you have lots of
External Methods, it's a bit messy to keep your code in one place away
from your object.

A better solution is to create a Python class (in a Product) and
sprinkle a little ZClass magic pixie dust in the __init__.py file to
make the Python class (PClass) subclassable by a ZClass.  Thus when you
create your ZClass, you can specify that one of it's base classes be the
PClass that you made subclassable.  Now all of the PClasse's python
methods are methods of the ZClass.

Yeah!  The Catalog uses this method heavily.  In fact, the only methods
actually defined in the ZClass are the managment and searching
interfaces.  All the guts are written in Python.

> 
> The interface is a little clunky in places ie. how do you 
> make a view be
> the second in the list instead of the first? Also, how do you 
> control the
> order that the item appears in the Add object dropdown?
> 

Basic stack theory tells us that through various manipulations of the
'First' operation, you can arrange the views any way you want.  Play
with it a bit and you'll get it how you want it.

The add menu is simply sorted alphabetically.  There is no way to
control how anything shows up in the select box.

> Anyway from the CVS checkin reports I can see these kinds of 
> issues are
> being looked already!

Yep.
> 
> Amazinly Zopalicious!

Thank (or blame) Jim, the Guru-on-the-mountain.

-Michel
> 
> -------
> Jordan B. Baker -- jbb@spyderlab.com
> weaving the web @ http://www.spyderlab.com
> 
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
> 
> (For developer-specific issues, use the companion list,
> zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
>