[Zope-dev] not getting any backtrace on product import

Ross Boylan RossBoylan@stanfordalumni.org
Wed, 12 Jan 2000 16:52:11 -0800


1) You need an __init__.py in your product subdirectory.
2) If the initial import fails, you don't get a warning.  Modify it like
this to capture the trace (I got the code from some other example..)

As you might guess, I learned this the hard way...

import OrgUser


def initialize(context):
    try:
	context.registerClass(
            OrgUser.OrgUserFolder,
            constructors=(OrgUser.manage_addUserFolder, )
            )

    except:
        """If you can't register the product, tell someone.

        Zope will sometimes provide you with access to "broken product" and
        a backtrace of what went wrong, but not always; I think that only
        works for errors caught in your main product module.

        This code provides traceback for anything that happened in
        registerClass(), assuming you're running Zope in debug mode."""

        import sys, traceback, string
        type, val, tb = sys.exc_info()
        sys.stderr.write(string.join(
	    traceback.format_exception(type, val, tb),''))
        del type, val, tb



> -----Original Message-----
> From: zope-dev-admin@zope.org [mailto:zope-dev-admin@zope.org]On Behalf
> Of Stefan Kuzminski
> Sent: Wednesday, January 12, 2000 4:30 PM
> To: zope-dev@zope.org
> Subject: [Zope-dev] not getting any backtrace on product import
>
>
>
> I'm developing a new product and if there is any error ( syntax
> or whatever )
> when I restart zope, it fails to print anything to let me know what went
> wrong.  The product just isn't in the list of 'Available objects' in the
> management screen.  Is there anyway to get this basic information..?
>
> thanks,
> Stefan Kuzminski
>
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )
>