[Zope] NameError instantiating ZClass instance, but it used to work!
Brad Clements
bkc@murkworks.com
Tue, 21 Aug 2001 15:21:45 -0400
Running Zope 2.3.3 on RH Linux 7.1
I created a Product with 3 Zclasses. 2 of the 3 Zclasses work okay, but one of them
raises a NameError during the add process saying that it can't find the ZClass itself,
even though the darn thing is listed in the Product folder. (Also, Monitor Client shows it's
there too, see below)
>From ZMI, selecting Add "Searchable Company", then entering the ID results in the
traceback.
I'm totally stumped trying to fix this, anyone have any ideas how to figure this out?
I tried exporting to XML and re-importing the Product (after deleting it) but the XML
import process raises an Exception (not enough args passed).
I tried export/reimport in .zexp format, but the results are the same.
This is a standard ZClass that is based on ZObject, _ZClass_for_PortalFolder,
_ZClass_for_DefaultDublinCoreImpl. (and 1 other Zclass in this product has the same
base classes)
It *used* to work, but today I find that I can't create any more instances.
Using ZMI, I get this:
Error Type: NameError
Error Value: SearchableCompany
Traceback (innermost last):
File /usr/holmes/AdkWood/lib/python/ZPublisher/Publish.py, line 223, in publish_module
File /usr/holmes/AdkWood/lib/python/ZPublisher/Publish.py, line 187, in publish
File /usr/holmes/AdkWood/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook
(Object: RoleManager)
File /usr/holmes/AdkWood/lib/python/ZPublisher/Publish.py, line 171, in publish
File /usr/holmes/AdkWood/lib/python/ZPublisher/mapply.py, line 160, in mapply
(Object: SearchableCompany_add)
File /usr/holmes/AdkWood/lib/python/ZPublisher/Publish.py, line 112, in call_object
(Object: SearchableCompany_add)
File /usr/holmes/Zope-2.3.3/lib/python/OFS/DTMLMethod.py, line 189, in __call__
(Object: SearchableCompany_add)
File /usr/holmes/Zope-2.3.3/lib/python/DocumentTemplate/DT_String.py, line 540, in __call__
(Object: SearchableCompany_add)
File /usr/holmes/Zope-2.3.3/lib/python/DocumentTemplate/DT_With.py, line 138, in render
(Object: SearchableCompany.createInObjectManager(REQUEST['id'], REQUEST))
File /usr/holmes/Zope-2.3.3/lib/python/DocumentTemplate/DT_Util.py, line 339, in eval
(Object: SearchableCompany.createInObjectManager(REQUEST['id'], REQUEST))
(Info: SearchableCompany)
File <string>, line 0, in ?
NameError: (see above)
And from within CMF, I'm getting an "Unauthorized" exception trying to add an instance
through invokeFactory, even though I'm logged in as Manager.
Using the CMF and adding an instance to My Stuff, I get this:
You are not authorized to access SearchableCompany.
Traceback (innermost last):
File /usr/holmes/AdkWood/lib/python/ZPublisher/Publish.py, line 223, in publish_module
File /usr/holmes/AdkWood/lib/python/ZPublisher/Publish.py, line 187, in publish
File /usr/holmes/AdkWood/lib/python/ZPublisher/Publish.py, line 171, in publish
File /usr/holmes/AdkWood/lib/python/ZPublisher/mapply.py, line 160, in mapply
(Object: invokeFactory)
File /usr/holmes/AdkWood/lib/python/ZPublisher/Publish.py, line 112, in call_object
(Object: invokeFactory)
File /usr/holmes/AdkWood/Products/CMFCore/PortalFolder.py, line 368, in invokeFactory
(Object: Traversable)
File /usr/holmes/AdkWood/Products/CMFCore/TypesTool.py, line 745, in constructContent
(Object: Traversable)
File /usr/holmes/AdkWood/Products/CMFCore/TypesTool.py, line 476, in constructInstance
(Object: ElementWithAttributes)
File /usr/holmes/AdkWood/lib/python/Shared/DC/Scripts/Bindings.py, line 324, in __call__
(Object: addSearchableCompany)
File /usr/holmes/AdkWood/lib/python/Shared/DC/Scripts/Bindings.py, line 354, in _bindAndExec
(Object: addSearchableCompany)
File /usr/holmes/Zope-2.3.3/lib/python/Products/PythonScripts/PythonScript.py, line 336, in _exec
(Object: addSearchableCompany)
(Info: ({'script': <PythonScript instance at 8939a30>, 'context': <FactoryDispatcher instance at 8845f98>, 'container': <FactoryDispatcher instance at 8845f98>, 'traverse_subpath': []}, ('test2',), {}, None))
File Script (Python), line 2, in addSearchableCompany
File /usr/holmes/AdkWood/lib/python/Products/PythonScripts/Guarded.py, line 273, in __getattr__
File /usr/holmes/AdkWood/lib/python/Products/PythonScripts/Guarded.py, line 143, in __careful_getattr__
File /usr/holmes/AdkWood/lib/python/Products/PythonScripts/Guarded.py, line 135, in aq_validate
File /usr/holmes/AdkWood/lib/python/AccessControl/SecurityManager.py, line 144, in validate
File /usr/holmes/AdkWood/lib/python/AccessControl/ZopeSecurityPolicy.py, line 225, in validate
Unauthorized: (see above)
addSearchableCompany is a Python script with this line:
return context.manage_addProduct['SearchableCompanies'].SearchableCompany.createInObjectManager(id,context.REQUEST)
--
And using Monitor client I AM able to get at SearchableCompany within the Product
elcome to <secure_monitor_channel connected 127.0.0.1:4483 at 88b72e0>
>>> import Zope
------
2001-08-21T19:15:06 INFO(0) ZServer 0:1 (exec)> 'import Zope'
>>> app = Zope.app()
------
2001-08-21T19:15:12 INFO(0) ZServer 0:2 (exec)> 'app = Zope.app()'
>>> cp = app.Control_Panel.Products.SearchableCompanies
------
>>> cp.SearchableCompany
------
2001-08-21T19:15:33 INFO(0) ZServer 0:5 (eval)> 'cp.SearchableCompany'
<ZClass instance at 8813658>
Brad Clements, bkc@murkworks.com (315)268-1000
http://www.murkworks.com (315)268-9812 Fax
netmeeting: ils://ils.murkworks.com AOL-IM: BKClements