Ñò ha-Kc@sdZddkZyddklZWn#ej oddklZnXdd$d„ƒYZedjo¦d%d&d'd(d)d*d+gd,gd-gZx|dd ddgD]dZdddfGHdeGHeeedddd d!d"ƒZ e i ƒGHdd#dfGHe i ƒGHq¦WndS(.skCreate menus and crumbs from a site hierarchy. You define the site hierarchy as lists/tuples. Each location in the hierarchy is a (url, description) tuple. Each list has the base URL/text in the 0 position, and all the children coming after it. Any child can be a list, representing further depth to the hierarchy. See the end of the file for an example hierarchy. Use Hierarchy(contents, currentURL), where contents is this hierarchy, and currentURL is the position you are currently in. The menubar and crumbs methods give you the HTML output. There are methods you can override to customize the HTML output. iÿÿÿÿN(tStringIOt HierarchycBsqeZdd d d„Zd d„Zd d„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z RS( tcCsa||_||_|od||_n d|_|od||_n d|_||_dS(s hierarchy is described above, currentURL should be somewhere in the hierarchy. prefix will be added before all of the URLs (to help mitigate the problems with absolute URLs), and if given, cssClass will be used for both links *and* nonlinks. s class="%s"RN(t _contentst _currentURLt _menuCSSClasst_crumbCSSClasst_prefix(tselft hierarchyt currentURLtprefixt menuCSSClasst crumbCSSClass((sA/usr/lib64/python2.6/site-packages/Cheetah/Tools/SiteHierarchy.pyt__init__s    cCsV|od||_ntƒ}x(|idD]}|i|d|ƒq/W|iƒS(sAn indented menu lists class="%s"ii(RRRt_menubarRecursetgetvalue(RR tstreamtitem((sA/usr/lib64/python2.6/site-packages/Cheetah/Tools/SiteHierarchy.pytmenuList5s cCsþ|od||_ng}|i}x‡tot}|i|dƒxU|dD]I}|i|ƒo3t|tƒo|i|ƒPqœ|}t}PqSqSW|pPq*q*Wt|ƒdjo |i ƒSt i t |d„|ƒ|i ƒƒ|iƒS(sThe home>where>you>are crumbss class="%s"iicSs|i|d|dƒS(ii(t crumbLink(txR((sA/usr/lib64/python2.6/site-packages/Cheetah/Tools/SiteHierarchy.pytXs(RRtTruetFalsetappendt _inContentst isinstancettupletlent emptyCrumbtstringtjointmaptcrumbSeperatortcrumbTerminator(RR tpathtpostfoundAnyR((sA/usr/lib64/python2.6/site-packages/Cheetah/Tools/SiteHierarchy.pytcrumbs?s0      cCse||ijp|i||ijodd||i|fSdd||i||i|fSdS(Ns%s%s
s is%s%s
s   s   (RRR(Rturlttexttindent((sA/usr/lib64/python2.6/site-packages/Cheetah/Tools/SiteHierarchy.pytmenuLink_s ' cCsW||ijp|i||ijod||ifSd|i||i|fSdS(Ns %ss%s(RRR(RR(R)((sA/usr/lib64/python2.6/site-packages/Cheetah/Tools/SiteHierarchy.pyRhs'cCsdS(Ns > ((R((sA/usr/lib64/python2.6/site-packages/Cheetah/Tools/SiteHierarchy.pyR"oscCsdS(NR((R((sA/usr/lib64/python2.6/site-packages/Cheetah/Tools/SiteHierarchy.pyR#rscCsdS(sWhen you are at the homepageR((R((sA/usr/lib64/python2.6/site-packages/Cheetah/Tools/SiteHierarchy.pyRuscCsœt|tƒo|\}}g}n|d\}}|d}|i|i|||ƒƒ|i|ƒo,x)|D]}|i||d|ƒqsWndS(Nii(RRtwriteR+RR(RtcontentsR*RR(R)trestR((sA/usr/lib64/python2.6/site-packages/Cheetah/Tools/SiteHierarchy.pyR{s   cCsLt|tƒo|i|djSx#|D]}|i|ƒotSq)WtS(Ni(RRRRRR(RR-R((sA/usr/lib64/python2.6/site-packages/Cheetah/Tools/SiteHierarchy.pyR‡s N( t__name__t __module__tNoneRRR'R+RR"R#RRR(((sA/usr/lib64/python2.6/site-packages/Cheetah/Tools/SiteHierarchy.pyRs      t__main__t/thomes/aboutsAbout Uss /servicestServicess/services/productstProductss/services/products/widgets The Widgets/services/products/wedges The Wedges/services/products/thimbles The Thimbles/services/pricestPricess/contacts Contact Uss

t=i2s
%s:
R tmenuR tcrumbR s/heret-((R3R4(s/aboutsAbout Us(s /servicesR5(s/services/productsR6(s/services/products/widgets The Widget(s/services/products/wedges The Wedge(s/services/products/thimbles The Thimble(s/services/pricesR7(s/contacts Contact Us( t__doc__Rt cStringIORt ImportErrorRR/R R(tnRR'(((sA/usr/lib64/python2.6/site-packages/Cheetah/Tools/SiteHierarchy.pyts2 u