logo       

How the hell do I debug assert _context.stack[-1].context is context: msg#00103

web.zope.z3base.five

Subject: How the hell do I debug assert _context.stack[-1].context is context

Hi guys,

We're diving into Z3/Five very seriously for the future Plone 3.0 release, and mostly it's proving a great benefit. However, I have one recurring problem (that I'm sure I'm not alone about).

Products/CMFPlone/configure.zcml includes an <include package=".browser" />. This in turn has an <include package=".contentmenu" /> (not in svn yet, but you get the idea - I doubt the second include makes any difference anyway).

This file references interfaces (for=".interfaces.IFooBar"), classes (class=".menu.ActionsMenu") etc. If there are any errors in that file - if I refer to an interface that doesn't exist, for example, or if there are syntax errors or run-time errors reading in the modules .interfaces or .menu, I get this:

LOG('Five', ERROR, 'Could not import Product %s' % product.__name__, error=exc)
Traceback (most recent call last):
File "testMenu.py", line 9, in ?
from Products.CMFPlone.tests import PloneTestCase
File "/Users/optilude/Development/Plone/Personal/plone3.0-zope2.9/Products/CMFPlone/tests/PloneTestCase.py", line 7, in ?
from Products.PloneTestCase.ptc import *
File "/Users/optilude/Development/Plone/Personal/plone3.0-zope2.9/Products/PloneTestCase/ptc.py", line 16, in ?
from Products.PloneTestCase.setup import PLONE21
File "/Users/optilude/Development/Plone/Personal/plone3.0-zope2.9/Products/PloneTestCase/setup.py", line 54, in ?
ZopeTestCase.installProduct('Five')
File "/Users/optilude/Development/Plone/Zope/2.9/current/lib/python/Testing/ZopeTestCase/ZopeLite.py", line 157, in installProduct
get_folder_permissions(), raise_exc=1)
File "/Users/optilude/Development/Plone/Zope/2.9/2.9.2/lib/python/OFS/Application.py", line 790, in install_product
initmethod(context)
File "/Users/optilude/Development/Plone/Zope/2.9/2.9.2/lib/python/Products/Five/__init__.py", line 29, in initialize
zcml.load_site()
File "/Users/optilude/Development/Plone/Zope/2.9/2.9.2/lib/python/Products/Five/zcml.py", line 41, in load_site
_context = xmlconfig.file(file)
File "/Users/optilude/Development/Plone/Zope/2.9/current/lib/python/zope/configuration/xmlconfig.py", line 554, in file
include(context, name, package)
File "/Users/optilude/Development/Plone/Zope/2.9/current/lib/python/zope/configuration/xmlconfig.py", line 492, in include
assert _context.stack[-1].context is context
AssertionError

It must swallow an exception somewhere, but I can't figure out where. The code is confusing to me, and my attempts at pdb didn't get me any closer.

I'm wondering if I'm doing something wrong - in which case, please let me know. I've lost probably a few hours to this thing over the past week, because things that are very simple become nearly impossible to locate without significant amounts of trial-and-error. :-(

Martin

--
"You can just adapt yourself out of it..." // Archipelago sprint 26/04/2006



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise