[Zope] NameError: global name 'Project' is not defined

Dieter Maurer dieter@handshake.de
Wed, 16 Jan 2002 20:28:00 +0100


Mark Lilly writes:
 > ...
 > When i make a folder in the root directory and then add this product, i get
 > the following error when i type in an ID and click Add.
 > ...
 > Site Error
 > An error was encountered while publishing this resource. 
 > NameError
 > Sorry, a site error occurred. 
 > Traceback (innermost last):
 >   File C:\zz\zope\Southern\lib\python\ZPublisher\Publish.py, line 223, in
 > publish_module
 >   File C:\zz\zope\Southern\lib\python\ZPublisher\Publish.py, line 187, in
 > publish
 >   File C:\zz\zope\Southern\lib\python\Zope\__init__.py, line 226, in
 > zpublisher_exception_hook
 >     (Object: Project_factory)
 >   File C:\zz\zope\Southern\lib\python\ZPublisher\Publish.py, line 171, in
 > publish
 > ....
 > File C:\zz\zope\Southern\lib\python\DocumentTemplate\DT_Util.py, line 231,
 > in eval
 >     (Object: Project.createInObjectManager(REQUEST['id'], REQUEST))
 >     (Info: REQUEST)
 >   File <string>, line 2, in f
 >     (Object: guarded_getitem)
 > NameError: global name 'Project' is not defined
I have seen a similar report recently (--> mailing list archives).

I must say, I do not know what is wrong. Apparently, everything
is as it should be.
With one exception:

  The traceback contains a strange entry: "zpublisher_exception_hook".

This suggests that what you see is a secondary exception.

These secondary errors make analysis of the primary error difficult.
When I run into such a case, I modify "ZPublisher/Publish.py"
near line 106 in the following way:

        if transactions_manager: transactions_manager.abort()

        # DM
        import traceback; traceback.print_exc()
        
        if err_hook is not None:

This prints the primary exception to standard error - for analysis.

Be aware, you will get lots on exceptions printed that are
harmless: "Unauthorized", "Redirect" and so on.

You are only interested in the output immediately before your
error occurs.


Dieter