Multiple Resource Folders and Acquisition
Good day all, I would like to construct a site using folders to collect similar resources, and acquisition to allow customization from defaults. 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. 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. I am thinking of writing a script that ties into the standard_error_message that re-acquires NotFound errors. But I can't quite nail the specifics since the filename of the original request does not seem to be available. I also don't really know much about the Errors object, and since all the code that displays errors is in DTML (which I do not know well) I get confused quickly trying to work with stock standard_error_messages. Anyone with thoughts on this subject? The only out-of-the-box alternative is to not nest graphical resources in a graphics folder, but that would get exceptionally messy. --- Edward J. Pollard University of Lethbridge Web Development
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
Thanks for the quick reply. Yes, that would work. But it would make a horrible mess of my directory. (with rollovers, etc, somewhere near 50 images need to be in the root). Ironically, I'd be happy to have the site specific outside a subfolder, as they number <5. Oh well... I would *really* like to find a simple way to tidy this up. I've not been able to get the standard_error_message to redirect to a graphic, although I can get it to return the graphic with accompanying generic IMG tags. *sigh* --- Edward J. Pollard University of Lethbridge Web Development On Monday, September 15, 2003, at 04:04 PM, Dylan Reinhardt wrote:
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.
Yes, that would work. But it would make a horrible mess of my directory. (with rollovers, etc, somewhere near 50 images need to be in the root). Ironically, I'd be happy to have the site specific outside a subfolder, as they number <5. Oh well...
I would *really* like to find a simple way to tidy this up. I've not been able to get the standard_error_message to redirect to a graphic, although I can get it to return the graphic with accompanying generic IMG tags. *sigh*
There is something called TransparentFolder, which makes acquisition work in reverse. It can cause a performance hit, but you'll have to decide whether that is worth the cleaning-up you get. Another option is to do something like / graphics img1 img2 sites site1 graphics img3 You can also use an OrderedFolder (built-in in 2.7) to stick all the images to the bottom. --jcc -- "Code generators follow the 80/20 rule. They solve most of the problems, but not all of the problems. There are always features and edge cases that will need hand-coding. Even if code generation could build 100 percent of the application, there will still be an endless supply of boring meetings about feature design." (http://www.devx.com/java/editorial/15511)
Edward Pollard wrote at 2003-9-15 15:32 -0600:
I would like to construct a site using folders to collect similar resources,
Do not do that! For Zope, it is much better to group objects based on usage patterns rather than type. If you really what to do it, you may look at the CMF SkinsTool or my "SkinnedFolder". <http://www.dieter.handshake.de/pyprojects/zope> Dieter
participants (4)
-
Dieter Maurer -
Dylan Reinhardt -
Edward Pollard -
J Cameron Cooper