I'm a newbie learning Python and Zope. I'm trying to create a Zope product for my application since programming is more familiar to me than HTML. I ran into a problem that caused me to join this list. In the process of figuring out how to best ask the question, I found the answer. I had created a package using the example in "The Book of Zope". When I first restarted the server, I got an error message in the list of products saying that my package was broken. It had an error log showing the line (a typo) that was causing the problem. I fixed the line but restarting Zope kept giving me the same error message on the same line that I had fixed. I decided that something funny was going on so I deleted the package from the "Product Management at /Control_Panel/Products" screen in the hopes that it would be recreated or I would at least get a new error message. The product went away completely and nothing I could do would get it back. I tried moving it to a different directory, changing the metadata name, changing the class names, nothing worked. I could look in the directory and see that my __init__.pyc file was being created so I knew Zope was looking at it but it didn't seem to do anything with it. After working on it for most of the day, I finally found the problem. At some point, I had accidentally deleted the "s" from the end of the constructors' In other words, instead of this; def initialize(context): """Register the EIS class""" context.registerClass( EIS.EIS, constructors = ( EIS.manage_addEISForm, EIS.manage_addEIS ), permission = 'Add EIS', icon='www/icon.gif' ) I had This; def initialize(context): """Register the EIS class""" context.registerClass( EIS.EIS, constructor = ( EIS.manage_addEISForm, EIS.manage_addEIS ), permission = 'Add EIS', icon='www/icon.gif' ) Notice the missing "s" in "constructor =". That was doing it. Now, here's my question, is there an error log anywhere that would have shown what was causing the problem without searching for a needle in a haystack? I was looking all over the place for some kind of message as to why the package wasn't showing up but couldn't find anything. I'm assuming I just don't know where to look.
Goldthwaite, Joe wrote:
...
The product went away completely and nothing I could do would get it back. I tried moving it to a different directory, changing the metadata name, changing the class names, nothing worked. I could look in the directory and see that my __init__.pyc file was being created so I knew Zope was looking at it but it didn't seem to do anything with it.
After working on it for most of the day, I finally found the problem. At some point, I had accidentally deleted the "s" from the end of the constructors' In other words, instead of this;
...
Notice the missing "s" in "constructor =". That was doing it. Now, here's my question, is there an error log anywhere that would have shown what was causing the problem without searching for a needle in a haystack? I was looking all over the place for some kind of message as to why the package wasn't showing up but couldn't find anything. I'm assuming I just don't know where to look.
There is an event log (set the STUPID_LOG or the newer EVENT_LOG_FILE environment variable, or presumably a similar option in 2.7's config file), but whether such an error would be logged is a different question. 'registerClass' should probably have thrown a TypeError with a message like "registerClass() got an unexpected keyword argument 'constructor'" (and you would probably see this on the console if you're running Zope that way) but there are situations where it may accept any keyword arguments you give it, in which case you wouldn't get an error and it would just silently ignore the 'constructor' argument and assume you just didn't give it a 'constructors' argument. ---jcc -- "My point and period will be throughly wrought, Or well or ill, as this day's battle's fought."
participants (2)
-
Goldthwaite, Joe -
J. Cameron Cooper