This is a basic tree configuration:<div><br></div><div><div>class TreeData(fixture.DataSet):</div><div><br></div><div> class branch:</div><div> tag = 'branch'</div><div><br></div><div> class leaf_one:</div>
<div> tag = 'leaf_one'</div><div> owner = TreeData.branch</div><div><br></div><div> class leaf_two:</div><div> tag = 'leaf_two'</div><div> owner = TreeData.branch</div><div><br>
</div><div>Python doesn't like that because (unlike real languages) TreeData doesn't appear in the lookup namespace until it's fully defined.</div><div><br></div><div>The work-around is to build a different suite for each tier of the tree:</div>
<div><br></div><div><div>class TreeData(fixture.DataSet):</div><div> class branch:</div><div> tag = 'branch'</div><div><br></div><div>class TreeLeafData(fixture.DataSet):</div><div> class leaf_one:</div>
<div> tag = 'leaf_one'</div><div> owner = TreeData.branch</div><div><br></div><div> class leaf_two:</div><div> tag = 'leaf_two'</div><div> owner = TreeData.branch</div><div><br>
</div></div><div>That's really tacky - is there a simpler fix?</div><div><br></div><div>(On a related note, how do I supply the tag='my name' automatically, from the class name just above it?)</div><br>-- <br>
Phlip<br> <a href="http://c2.com/cgi/wiki?ZeekLand">http://c2.com/cgi/wiki?ZeekLand</a> <br>
</div>