[Zope] Multiple Resource Folders and Acquisition

Dylan Reinhardt zope at dylanreinhardt.com
Mon Sep 15 18:04:36 EDT 2003


On Mon, 2003-09-15 at 14:32, Edward Pollard wrote:
> Good day all,
> 
> I would like to construct a site using folders to collect similar 
> resources, and acquisition to allow customization from defaults.

Excellent.

> 
> To be specific, I want to have a "graphics" folder at the root, from 
> which all common elements are shared.
> 
> In subfolders, I want to place a "graphics" folder, in which specific 
> graphics for that area are placed. These graphics will override the 
> generic common elements from the root graphics folders.

So... you're doing some kind of virtual hosting/skinning thing?  Fine.


> Templates will then all use IMG SRC values of "graphics/blah". However, 
> I would like any elements that do not need to be customized to be found 
> in the original root folder. This of course goes against the default 
> behavior of acquisition.

Does it?  Let me see if I understand.

You have a setup like:

/
   graphics/
      img1
      img2
      img3
   site1/
      graphics/
         img1
         img3

And if you're browsing site1, you want the site1 versions of img1 and
img3 but the default img2.

Is that correct?

All that would be required to make this work is to put the default
images at the same level as site1, thus:

/
   img1
   img2
   img3
   site1/
      graphics/
         img1
         img3

Acquisition will work its magic without any additional help.  This
approach will work for methods and templates too, not just images.


> I am thinking of writing a script that ties into the 
> standard_error_message that re-acquires NotFound errors.

You could do that also, if other requirements prevent you from changing
how your images are organized.

HTH,

Dylan




More information about the Zope mailing list