[Zope-dev] Simple ZClass Stuff

Eric Roby vekn@msn.com
Sat, 26 May 2001 20:35:52 -0500


I have been on this Zope journey since late February.  Most times Zope has
been like an artichoke, thorny on the outside but improves dramatically as
you peel off the layers and can get to the meat.  Other times (very few to
date) Zope is like an onion,  the more layers you peel off the more tears
you have to deal with.  Well this is one of those onion-times.

I have been exploring the processes involved in creating Zope products via
ZClasses.  I have read all the primers/How-To's, latest version of the Zope
Book.  I have been successful in creating a
Renderable:Renderable-ZCatalog:CatalogAware structured-text document class.
However, I am unable to create a simple
ZCatalog:CatalogAware-OFS:DTMLDocument class.  I have tried many different
incantations, sacrificed my first born but to no avail.  I have even tried
to just select OFS:DTMLDocument as my subclass.  Regardless how I slice it,
I consistently get:

Error Type: TypeError
Error Value: unsliceable object

The Traceback is as follows:                    ***Sorry, these guys still
evade my comprehension***
Traceback (innermost last):
  File F:\WebSite\lib\python\ZPublisher\Publish.py, line 223, in
publish_module
  File F:\WebSite\lib\python\ZPublisher\Publish.py, line 187, in publish
  File F:\WebSite\lib\python\Zope\__init__.py, line 221, in
zpublisher_exception_hook
    (Object: RoleManager)
  File F:\WebSite\lib\python\ZPublisher\Publish.py, line 171, in publish
  File F:\WebSite\lib\python\ZPublisher\mapply.py, line 160, in mapply
    (Object: htmlDocumentClass_add)
  File F:\WebSite\lib\python\ZPublisher\Publish.py, line 112, in call_object
    (Object: htmlDocumentClass_add)
  File F:\WebSite\lib\python\OFS\DTMLMethod.py, line 189, in __call__
    (Object: htmlDocumentClass_add)
  File F:\WebSite\lib\python\DocumentTemplate\DT_String.py, line 549, in
__call__
    (Object: htmlDocumentClass_add)
  File F:\WebSite\lib\python\DocumentTemplate\DT_With.py, line 133, in
render
    (Object: htmlDocumentClass.createInObjectManager(REQUEST['id'],
REQUEST))
  File F:\WebSite\lib\python\DocumentTemplate\DT_Util.py, line 334, in eval
    (Object: htmlDocumentClass.createInObjectManager(REQUEST['id'],
REQUEST))
    (Info: REQUEST)
  File <string>, line 0, in ?
  File F:\WebSite\lib\python\ZClasses\ZClass.py, line 543, in
createInObjectManager
    (Object: htmlDocumentClass)
  File F:\WebSite\lib\python\OFS\ObjectManager.py, line 265, in _getOb
    (Object: Traversable)
TypeError: (see above)

NOTE:
On one attempt, I modified the constructor input form to use
'addDTMLDocument' and the class method to use 'manage_edit' and
'manage_upload'.  These changes got past the 'unsliceable object' error,
however, when instantiating this class, I was unable to access the property
sheets and views that I had defined.  I was left with the default views
defined for the DTML Document class.

The Zope Book says I can create a new class using OFS:DTMLDocument as my
base class, generate my property sheets, hook my property sheets to views
and be on my way.

If anyone can enlighten me here I would be much in you debt.  Obviously, I
am missing a key point.

Eric