resource directory does not produce cache friendly URLs

Bug #220682 reported by Paul Carduner
4
Affects Status Importance Assigned to Milestone
Zope 3
Invalid
Undecided
Unassigned

Bug Description

The urls that ResourceDirectory generates for resources is always relative to the current url, rather than a site url. i.e., if you try to get the resource "resources/logo.jpg" it goes to
http://mysite.com/@@/resources/logo.jpg or
http://mysite.com/some/page/@@/resources/logo.jpg or
http://mysite.com/some/other/page/@@/resources/logo.jpg

It should always be built off a site level url no matter what page you are looking at, i.e. http://mysite.com/@@/resources/logo.jpg

This is a bug in zope.app.publisher.browser.directoryresource.py

Revision history for this message
Christophe Combelles (ccomb) wrote :

How do you "get a resource"?
Don't you want just to use /@@/resources/logo.jpg?

Revision history for this message
Paul Carduner (pcardune) wrote : Re: [Bug 220682] Re: resource directory does not produce cache friendly URLs

I would say something like:

absoluteURL(hooks.getSite(self.context), self.request)+'/'+path

where "path" is @@/resources/logo.jpg.

On Tue, Apr 22, 2008 at 2:22 PM, Christophe Combelles <email address hidden> wrote:
> How do you "get a resource"?
> Don't you want just to use /@@/resources/logo.jpg?

Revision history for this message
Philipp von Weitershausen (philikon) wrote :

On 22 Apr 2008, at 23:22 , Christophe Combelles wrote:
> How do you "get a resource"?

In a ZPT, you do context/++resource++RESOURCENAME. In Python you look
up a 1-ary multi-adapter for the request (like a view, but w/o the
context).

> Don't you want just to use /@@/resources/logo.jpg?

Not necessarily. You want Zope to generate that URL.

Revision history for this message
Christophe Combelles (ccomb) wrote :

What version does this apply?

When using : tal:attributes="src context/++resource++img/image.png",
it generates the same url for every subfolder.

Revision history for this message
Dan Korostelev (nadako) wrote :

Is this bug not valid anymore?

Changed in zope3:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.