breadcrumbs in a python script
Has anyone implemented something like the breadcrumbs trail in a python script instead of a dtml method? jason __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/
On Sat, 14 Apr 2001, Jason Byron wrote:
Has anyone implemented something like the breadcrumbs trail in a python script instead of a dtml method?
I did it in an External Method even! :) Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
Hi, I did, yes. It's really ugly, clumsy, bad style and probably faulty, but maybe it's a start: #Python Script 'crumbs' results=[] sub = context while sub != container: results.append( ['/' + sub.absolute_url(1), sub.title ]) sub = sub.restrictedTraverse( '..' ) results.append( ['/', 'Home'] ) results.reverse() results.pop() return results You can then use <dtml-in crumbs> <a href="<dtml-var expr="_.getitem('sequence-item')[0]">"> <dtml-var expr="_.getitem('sequence-item')[1]"></a> </dtml-in> to display the links. I'd be glad to see suggestions on how to better the approach. Cheers, Ben -- Ben Peter - Feldstrasse 8 - 35091 Coelbe Ben.Peter@t-online.de ph: (+49) 6421 983520
I have one, but my view source won't view the source of a Script (Python) for some reason. :-( It should be at: http://docwhat.gerf.org:9673/breadcrumbs/view_source But the breadcrubs Script seems to eat up the rest of the traversal magic. Does anyone know what could be wrong? Do I need to do something if there is still a traversal left? Ciao! -- Computers are not intelligent. They only think they are. The Doctor What: "What, Doctor What" http://docwhat.gerf.org/ docwhat@gerf.org KF6VNC
Jason Byron wrote:
Has anyone implemented something like the breadcrumbs trail in a python script instead of a dtml method?
jason
There is a fairly undocumented attribute named "aq_chain" which could be used. It contains a list of all the objects in the aquisition path. Iterating over it could be used to create breadcrumbs. hth, -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
participants (5)
-
Ben.Peter@t-online.de -
Casey Duncan -
Jason Byron -
Oleg Broytmann -
The Doctor What