[Zope] Generating links from a list

John Poltorak jp at warpix.org
Mon Jun 27 08:05:18 EDT 2005


The other week someone provided me with this snippet of code for 
generating links from a list containing a description and a link:-


     <span
tal:define="opts 
python:here.lib.parse_file(file=context.links,sepr=',',clone=1)">
       <tal:block repeat="opt opts">
          <li><a     tal:content="python:opt[1]"
               tal:attributes="href python:opt[0]"></a></li>
       </tal:block>
     </span>



This works fine, but now that I have used it in a template I'm finding 
that the link is being prepended with the location of the new object after 
selecting the original link. ie invoking the code above creates a link 
such as:- 

http://www.mysite.org/links/org-1

After selecting org-1 the new page displays as:-

http://www.mysite.org/links/org-1/links/org-1

Is there something in the code above which generates the full URL?

My links list consists of simple lines such as

org-1,First link
org-2,Second Link
org-x,Another Link

How do I prepend a hardcoded path to org-1 instead of what is getting 
generated?

I would like to see the link for org-1 being generated as

http://www.mysite.org/links/org-1

irrespective of the context.


-- 
John





More information about the Zope mailing list