[ZPT] Permanently reversed PARENTS... A Bug?

Geir Bækholt Geir Bækholt
Tue, 4 Dec 2001 10:42:11 +0100


Hello Felix, 

Tuesday, December 04, 2001, 9:46:12, you wrote:

FHH> Hi!

FHH> I was looking for an equivalent of <dtml-var ... reverse> in order to put 
FHH> breadcrumbs on the page.
FHH> I don´t want to reverse the request.PARENTS permanently so I like to copy it
FHH> before reversing to itemlist.
FHH> <span tal:define="itemlist request/PARENTS; dummy itemlist/reverse"
FHH> tal:repeat="item itemlist">
FHH> Breadcrumbs here
FHH> </span>
FHH> However, this still reverses request.PARENTS. I guess itemlist is only a
FHH> pointer to request.PARENTS, not a copy. Is that how tal:define is supposed 
FHH> to work?

copy a list in python by slicing the whole thing, instead of making a reference:

<span tal:define="itemslist python:request.PARENTS[:];dummy itemslist/reverse"

untested , but should work..

:-)

-- 
Geir Bækholt                       web-developer
geirh@funcom.com             funcom oslo | webdev-team