[Dev] Re: Need help with parcel import problem

Phillip J. Eby pje at telecommunity.com
Fri Oct 28 17:48:06 PDT 2005


At 04:35 PM 10/25/2005 -0700, Bryan Stearns wrote:
>Hope you're weathering the weather :-) ...  I'm trying to track down a 
>problem where an installParcel() is getting called twice, with different 
>values for the 'parcel' parameter (which means it creates twice as many 
>repository items, parented in two different places!).
>
>The parcel is parcels/osaf/framework/attributeEditors. the __init__.py in 
>this directory imports (among other things) installParcel() from the 
>AttributeEditors.py file (also in this directory). If I put a breakpoint 
>on the installParcel() method in AttributeEditors.py, and launch Chandler 
>with --create, I see that it gets called twice, with different 'parcel's:
>
>The first time, the 'parcel' parameter prints as: <Parcel (new): 
>attributeEditors e9260d9a-459a-11da-c3e3-0050f2e8b09c> (note the lowercase 
>"a" in "attributeEditors"). The second time, it prints as: <Parcel (new): 
>AttributeEditors e9260d9a-459a-11da-c3e2-0050f2e8b09c> (note the uppercase 
>"A" in "AttributeEditors").

The problem here is that AttributeEditors is a parcel, too.  So, you are 
indeed getting it called twice.  If you want the AttributeEditors module to 
be part of the parent package's parcel, you need a __parcel__ at the top, 
of 'osaf.framework.attributeEditors'.  Otherwise, it is assumed to be an 
independent parcel, so its installParcel() gets called.

Modules with a __parcel__ are part of that parcel, modules without a 
__parcel__ *are* parcels.  Thus, in this case, 
AttributeEditors.installParcel() is called once to install the 
AttributeEditors (sub)parcel, and once by the code in the parent parcel.



More information about the Dev mailing list