[Chandler-dev] Resolving import dependencies

Grant Baillie grant at osafoundation.org
Thu Aug 10 15:39:28 PDT 2006


Last week, Travis was trying to write some unit tests that were  
failing miserably, and what it boiled down to was that there are at  
least a couple of cases where parcels can't be loaded on their own.  
For example, if you load up "osaf.views.main" via:

./release/RunPython tools/headless.py --profile /tmp/profile -a  
osaf.views.main --create

then you get:

   File "/Users/grant/src/chandler/application/schema.py", line 1245,  
in _init_schema_item
     module.installParcel(item, None)
   File "/Users/grant/src/chandler/parcels/osaf/views/main/ 
__init__.py", line 31, in installParcel
     makeSummaryBlocks (parcel)
   File "/Users/grant/src/chandler/parcels/osaf/views/main/ 
summaryblocks.py", line 37, in makeSummaryBlocks
     detailBranchPointDelegate =  
detail.DetailBranchPointDelegate.update(
NameError: global name 'detail' is not defined

It turns out that summaryblocks.py expects detail to get defined by  
the import at line 16:

from osaf.framework.blocks import *

but somehow (I guess because detail is a package, not a module) that  
hasn't happened at the time the above code is called.

So, my question is, what's the "right" fix here? One somewhat cheesy  
way was to add "from osaf.framework.blocks import detail" below the *  
import in summaryblocks.py.

--Grant




More information about the chandler-dev mailing list