[Zope] simple z-class problem

Sascha Welter welter@network-ag.com
Fri, 19 Jul 2002 10:32:40 +0200


Ben Avery wrote:

 > Now when I try to create an instance of it in a development folder,I
 > get the constructor form, but then a NameError:
 > *Error Type: NameError*
 > *Error Value: global name 'CalendarEvent' is not defined*
 > trace below:
...snip...
 > File /export/home/Zope-2.5.1/lib/python/DocumentTemplate/DT_Util.py,
 > line 159, in eval
 > (Object: CalendarEvent.createInObjectManager(REQUEST['id'], REQUEST))
 >     (Info: REQUEST)
 >   File <string>, line 2, in f
 > NameError: (see above)
 >
 >
 > I have done this exact procedure before, with success. Now it doesn't
 > work. I've rebooted the zope server.
 > I'm using Zope 2.5.1, Python 2.1.3 on Solaris 2.7.
 >
 > Has anyone else seen this, or can anyone tell me what I'm doing wrong?

Yo Ben,

yes I've seen it. A couple of days ago. Cost me almost half a day to get 
working again. From what I can reconstruct, I had done the following:

I had created a simple product some days ago, with a single folderish
Z-Class in there. Then I successfully worked on that Z-Class and created
instances off that Z-Class.

Yesterday I created another Z-Class in my product. I set up the second
Z-Class in the "Subobjects" pane, so I can insert instances of it into
the first Z-Class. It doesn't like that. So I go back, delete my second
Z-Class (with corresponding Constructors, Factories and all that).

Next I create a new Product, insert my second Z-Class. Find out I can't
insert it into an instance of my first Z-Class, with the same error that
you've got. Tryed to insert it into the Root folder, same error. Tryed
to insert the first Z-Class into the Root folder. Same error. Made a new
Product/Z-Class, tryed inserting that. Same error.

Restarted Zope. Rebuilt database. No go. I actually messed around a
little bit more, then had the good idea to export my first Product as a
backup.

What I did in the end: Well I am lucky to have Gidon here, my cow-orker
and local Zope hero. Together we decided that there must be something
messed up with the ZODB, probably because that machine was running a
2.5.1b1 of Zope (btw. using Python 2.1.2 on OpenBSD 3.1/macppc). So I
installed Zope 2.5.1 (without beta) with a little help from Gidon (and
learned something more ;?) Then tryed to run the old Data.fs with the
new Zope. Same errors.

So I took the "empty" Data.fs from the new Zope install and imported my
valuable Product into it. That solved it. Of course I was lucky that
this instance had just this one piece of real work in it.

Conclusion: I can only guess at the reason for the problem. But if I
need to guess I would think that the beta version messed up, probably
because I was doing something weird with trying to add different
Z-Classes from the same product into each other while also editing Class
and Instance rapidly in separate windows. But this is just a guess from
a short experience on Zope. I've saved a copy of the "bad" Data.fs for
my cow-orker and he wants to have a look at it when he ever finds time.

Also under subject "Disappearing manage_options Tab" Barry Berenberg wrote:

 > Are there many other browser-specific problems that anyone is
 > aware of? For example, using IE (either Windows or Mac), I am unable
 > to add instances of add instances of ZClasses I have written - Zope
 > just returns a NameError. (I once tracked down another reference to
 > this on Zopera, but I'm unable to find it again.)

I don't know if my problem was browser specific. I am using Mozilla 1.0 
on Mac OS X to access the management interface. But before and after 
this incident, I was always able to add instances of ZClasses.

Regards,

Sascha


-- 
Sascha Welter           <mailto:welter@network-ag.com>
Network AG              Programmer, Sysop, IT-Support, BOfH
Ruetistrasse 17         Tel. 01 755 40 20
CH-8952 Schlieren       <http://www.network-ag.com>