[Zope] Generating links from a list

John Poltorak jp at warpix.org
Mon Jun 27 14:05:12 EDT 2005


On Mon, Jun 27, 2005 at 10:03:08AM -0600, Nikko Wolf wrote:
> John Poltorak wrote:
> 
> > 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
> 
> Check the "HREF" attribute of the links in the generated HTML, and see 
> what you are getting there; unrooted paths are appended (by the browser, 
> not Zope) to the directory component of the source URL.
> 
> For example:       <A HREF="org-2">Second Link</A>
> in a page at:      http://mysite.org/links/org-1
> should equate to:  http://mysite.org/links/org-2
> 
> [If you're still having problems, be explicit on the HREF and the URL 
> you are seeing.]
>
> 
> And have you tried simply replacing "org-1" in the File with 
> "http://www.mysite.org/links/org-1" ?

Just tried - and that does work, but the actual site will be changing 
before long.
 
 
> Finally -- from the ZPT snippet, it looks like "links" is a File object, 
> yet you put it in the URL that you say you wish.  It's *sometimes* not a 
> problem given Zope's sibling-acquisition when parsing paths, but could be.


That's right 'links' simply contains a list of objects and descriptions as 
shown above. When a web page is displayed the objectname is prepended by 
the directory component. I assumed that Zope did that, but I guess I was 
wrong.

What I really need is to change this line:-

tal:attributes="href python:opt[0]" 

to something like:-

tal:attributes="href '/mysite/links/' python:opt[0]

but I can't figure out how to prepend python:opt[0] with '/mysite/links/'.

Any hints?


> 
> G'Luck
> Nikko
> 


-- 
John




More information about the Zope mailing list