[Product-Developers] Re: kupu base href

Raphael Ritz r.ritz at biologie.hu-berlin.de
Wed May 14 08:39:37 UTC 2008


Derek Richardson wrote:
> I am attempting to rewrite the urls generated by kupu into a different 
> format (I'm moving the content between sites and rearranging in the 
> process and need links to be uuids, not normal hrefs. I'll transform 
> them back into normal hrefs on the other side.). So, I need to take a 
> kupu url and traverse to the object it represents.
> 
> Kupu generates only relative urls for internal links and depends on the 
> base element's href attribute for resolution. So, I need to resolve the 
> relative urls into absolute urls, of which I can then chop the front 
> part and throw it away, leaving a string I can pass to restricted traverse.
> 
> The problem is that I cannot figure out how plone generates the base 
> href for a page. For a folder, it seems to be that folder. But, for a 
> page, it seems to be the folder the page is in. This surprised me.
> 
> This may be as convoluted as it gets, but, having been surprised once, 
> I'd like to see the code plone uses to generate the base href. Does 
> anyone know where it lives? Or does anyone know a better way to do what 
> I'm trying to do?


Maybe it helps to look at the code that kupu uses itself when you enable
'link by uid'?

E.g.
http://codespeak.net/svn/kupu/trunk/kupu/plone/kupu_plone_layer/resolveuid.py

or

   http://codespeak.net/svn/kupu/trunk/kupu/plone/html2captioned.py

(towards the end)

Raphael


> 
> Thanks,
> 
> Derek





More information about the Product-Developers mailing list