[Zope] ZClass Product distribution woes

Behrens Matt - Grand Rapids Matt.Behrens@Kohler.Com
Fri, 12 Oct 2001 08:30:02 -0400


I have a ZClass-based Product on one server and I want to copy it to 
another.

I am using import/export to do this.  I also tried the Distribution tab 
this morning but it had the same problem.  (I restored Data.fs afterwards.)

Yesterday, I was able to import the Product into the second server and 
use it.  Today, I import it, and try to instantiate it, and get the 
following traceback on the ..._add method:

----

Traceback (innermost last):
   File /R02/zope/lib/python/ZPublisher/Publish.py, line 223, in 
publish_module
   File /R02/zope/lib/python/ZPublisher/Publish.py, line 187, in publish
   File /R02/zope/lib/python/Zope/__init__.py, line 226, in 
zpublisher_exception_hook
     (Object: RoleManager)
   File /R02/zope/lib/python/ZPublisher/Publish.py, line 171, in publish
   File /R02/zope/lib/python/ZPublisher/mapply.py, line 160, in mapply
     (Object: DefconContainer_add)
   File /R02/zope/lib/python/ZPublisher/Publish.py, line 112, in call_object
     (Object: DefconContainer_add)
   File /R02/zope/lib/python/OFS/DTMLMethod.py, line 194, in __call__
     (Object: DefconContainer_add)
   File /R02/zope/lib/python/DocumentTemplate/DT_String.py, line 546, in 
__call__
     (Object: DefconContainer_add)
   File /R02/zope/lib/python/DocumentTemplate/DT_With.py, line 133, in 
render
     (Object: DefconContainer.createInObjectManager(REQUEST['id'], REQUEST))
   File /R02/zope/lib/python/DocumentTemplate/DT_Util.py, line 231, in eval
     (Object: DefconContainer.createInObjectManager(REQUEST['id'], REQUEST))
     (Info: REQUEST)
   File <string>, line 2, in f
     (Object: guarded_getitem)
NameError: global name 'DefconContainer' is not defined

----

DefconContainer is the name of the ZClass I am trying to instantiate.  I 
have a slightly modified ..._add method, just to init a property sheet:

----

<HTML>
<HEAD><TITLE>Add DefconItem</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">

<dtml-comment> We add the new object by calling the class in
                 a with tag.  Not only does this get the thing
                 added, it adds the new thing's attributes to
                 the DTML name space, so we can call methods
                 to initialize the object.
</dtml-comment>

<dtml-with "DefconItem.createInObjectManager(REQUEST['id'], REQUEST)">

        <dtml-call "propertysheets.properties.manage_editProperties(
                   REQUEST)">

</dtml-with>

<dtml-comment> Now we need to return something.  We do this via
                 a redirect so that the URL is correct.

                 Unfortunately, the way we do this depends on
                 whether we live in a product or in a class.
                 If we live in a product, we need to use DestinationURL
                 to decide where to go. If we live in a class,
                 DestinationURL won't be available, so we use URL2.
</dtml-comment>
<dtml-if DestinationURL>

  <dtml-call "RESPONSE.redirect(
        DestinationURL+'/manage_workspace')">

<dtml-else>

     <dtml-call "RESPONSE.redirect(
            URL2+'/manage_workspace')">
</dtml-if>
</body></html>

----

I would be tearing my hair out if I hadn't shaved my head over Labor Day 
weekend.  Any ideas?  I have restarted, packed, cleared cache... 
basically done everything but try to recreate the Product.  (Shudder.) 
I cannot for the life of me figure out why this worked yesterday and 
doesn't work today.

-- 
Matt Behrens <matt.behrens@kohler.com>
System Analyst, Baker Furniture