[Zope] Re: Acquisition - I don't get it
Jan Bruvoll
jan at bruvoll.com
Mon Jan 31 09:57:53 EST 2005
Hi Malcolm,
thanks for your very quick reply.
So - if I want to do it "my way", I'd have to write a quick python
method that does the searching for me, I presume.
However, I already tried doing away with the folders and putting those
images directly into the folders, so that there are images across the
site like this:
/top
/top/site-title.gif
/top/section1/
/top/section1/section-title.gif
/top/section1/chapter1
/top/section1/chapter1/page-title.gif
/top/section1/chapter1/paragraph1
/top/section1/chapter1/paragraph1/page-title.gif
...
It works in those folders where the relevant images actually are, but the traversal does not kick in. Any pointers to this as well maybe?
Thanks again
Best regards
Jan
Malcolm Cleaton wrote:
>Each element of the path is acquired in turn, and acquisition doesn't
>backtrack when something cannot be found.
>
>So in this case, it starts at the current level and looks for "img", and
>finds it. So far so good! Then, it starts from that img folder and looks
>for your image "section_title.gif". It's not here! So, acquisition will
>move on to search the parent of the img folder, and the parent of that,
>and so on. Your section title image can't be found anywhere! Result: Not
>found. At no point will the process backtrack and try other possible "img"
>folders - when you say "img", you get the first one that can be acquired,
>and then that's that.
>
>To acquire images in the way you describe, you would need to do away with
>your "img" folders, and include the images directly in each folder in your
>hierarchy.
>
>Thanks,
>Malcolm.
>
>
>On Mon, 31 Jan 2005 14:40:43 +0000, Jan Bruvoll wrote:
>
>
>>Hi there,
>>
>>I've been struggling with something that must be very basic, but I just
>>don't get it. Hopefully, there's somebody out there who could enlighten
>>me a little...
>>
>>I have this site hierarchy, something like this:
>>
>>/top
>>/top/section1/
>>/top/section1/chapter1
>>/top/section1/chapter1/paragraph1
>>/top/section1/chapter1/paragraph2
>>/top/section1/chapter2
>>/top/section1/chapter2/paragraph1
>>/top/section2/
>>/top/section2/chapter1
>>/top/section2/chapter1/paragraph1
>>
>>etc.
>>
>>These are all folders with an index_html inside them. The template will
>>have, among other things, a site title image, a section title image, and
>>a page title image for each page.
>>
>>The idea here is to be able to create a folder img/ at appropriate
>>levels of this hierarchy and use images section_title.gif,
>>chapter_title.gif, page_title.gif, etc. This might be where I've
>>misunderstood everything, but I was hoping to do something like this:
>>
>><img src="dummy.gif" class="title-img" tal:define="image
>>here/img/section_title.gif" tal:attributes="src image/absolute_url" />
>>
>>If for instance looking at one of the paragraph pages, the template
>>would then, in my perfect world, start looking for an "img/" folder at
>>the current level, and within it a file named "section_title.gif", and
>>if it does not find it, it will try again one level up in the hierarchy,
>>until it then finds the section_title.gif in the folder
>>/top/section1/img/section_title.gif. Same goes for the other images, but
>>they would "hit" further down in the hierarchy so that I could
>>effectively let a "closer" image override one with the same name, but
>>further up.
>>
>>Have I got it completely wrong? Is my thinking right, but my syntax
>>wrong? Haven't been able to get anywhere on this - all documentation I
>>can find gives hints and pointers, but I'm still stuck...
>>
>>Any help & comments highly appreciated!
>>
>>Best regards
>>Jan
>>
>>
More information about the Zope
mailing list