Starting a search from the correct folder
I have some code which here:- <div><tal:loop tal:repeat="item python: request.PARENTS[-2::-1]">> <a href="ABSOLUTE_URL" tal:attributes="href item/absolute_url" tal:content="item/title_or_id">PARENT TITLE OR ID</a> </tal:loop></div> <ul tal:condition="python: context.objectValues(['Folder'])"> <li tal:repeat="item python: context.objectValues(['Folder'])"> <a href="ABSOLUTE_URL" tal:attributes="href item/absolute_url" tal:content="item/title_or_id">SUB-OBJECT TITLE OR ID</a></li> </ul> which automatically generates links to a number of folders which is exactly what I want. Understanding that Zope could do something like this has taken me quite a bit of time, although I still don't understand how this code works. What it actualy does is list the folders in the current folder and then allows me to select one which generates a subsequent list. What I'd like to do is skip the first list. If I want to generate a list of folders in say the 'groups' folder, how would I change the code above? -- John
--On 30. Juni 2005 22:27:37 +0100 John Poltorak <jp@warpix.org> wrote:
I have some code which here:-
<div><tal:loop tal:repeat="item python: request.PARENTS[-2::-1]">> <a href="ABSOLUTE_URL" tal:attributes="href item/absolute_url" tal:content="item/title_or_id">PARENT TITLE OR ID</a> </tal:loop></div>
<ul tal:condition="python: context.objectValues(['Folder'])"> <li tal:repeat="item python: context.objectValues(['Folder'])"> <a href="ABSOLUTE_URL" tal:attributes="href item/absolute_url" tal:content="item/title_or_id">SUB-OBJECT TITLE OR ID</a></li> </ul>
which automatically generates links to a number of folders which is exactly what I want. Understanding that Zope could do something like this has taken me quite a bit of time, although I still don't understand how this code works. What it actualy does is list the folders in the current folder and then allows me to select one which generates a subsequent list. What I'd like to do is skip the first list. If I want to generate a list of folders in say the 'groups' folder, how would I change the code above?
What is your real problem? I've read the posting three time and I not still not getting to the point what you mean. -aj
Andreas Jung wrote:
--On 30. Juni 2005 22:27:37 +0100 John Poltorak <jp@warpix.org> wrote:
I have some code which here:-
<ul tal:condition="python: context.objectValues(['Folder'])"> <li tal:repeat="item python: context.objectValues(['Folder'])"> <a href="ABSOLUTE_URL" tal:attributes="href item/absolute_url" tal:content="item/title_or_id">SUB-OBJECT TITLE OR ID</a></li> </ul>
What I'd like to do is skip the first list. If I want to generate a list of folders in say the 'groups' folder, how would I change the code above?
What is your real problem? I've read the posting three time and I not still not getting to the point what you mean.
John, I'm not sure what you mean either -- but if my guess *is* right, try changing the two occurrances of "context" to "context.groups" Nikko
John Poltorak wrote at 2005-6-30 22:27 +0100:
... If I want to generate a list of folders in say the 'groups' folder, how would I change the code above?
You are aware that you will not get a list (but a tree) when you look down from some starting point? When you are ready to look up (in the hierarchy), then obj.aq_inner.aq_parent is the hierarchy parent of "obj". -- Dieter
Dieter Maurer wrote:
You are aware that you will not get a list (but a tree) when you look down from some starting point?
I suspect he meant a list in the HTML - he is using <ul> and <li> tags there. But Dieter, can you elaborate on what you mean? Isn't the result from objectValues() a tuple [which would be a "list" in most languages]. Do you simply mean that the Folder objects may contain File, Document, Image or Folder objects, recursively? If not I'm not sure I follow. Thanks, N
Nikko Wolf wrote at 2005-7-1 15:40 -0600:
Dieter Maurer wrote:
You are aware that you will not get a list (but a tree) when you look down from some starting point?
... But Dieter, can you elaborate on what you mean? Isn't the result from objectValues() a tuple [which would be a "list" in most languages].
The poster described his aim *very* vaguely -- by an example that can be interpreted in different ways. I concentrated on the "PARENTS[...]" part of the example. It could mean that the poster is interested in part of a path but it unhappy with the point where the path starts. Now, if I choose a point and look upward, I see a single path, however, when I look downward, I usually see more than one.
Do you simply mean that the Folder objects may contain File, Document, Image or Folder objects, recursively? If not I'm not sure I follow.
Is the explanation above enough to explain what I meant? -- Dieter
On Fri, Jul 01, 2005 at 08:15:20PM +0200, Dieter Maurer wrote:
John Poltorak wrote at 2005-6-30 22:27 +0100:
... If I want to generate a list of folders in say the 'groups' folder, how would I change the code above?
You are aware that you will not get a list (but a tree) when you look down from some starting point?
I have problems with the terminology which Zope uses, but I think you understand what I meant.
When you are ready to look up (in the hierarchy), then
obj.aq_inner.aq_parent
is the hierarchy parent of "obj".
Well that would be useful if I understood what you meant. Is there a suggested explanation anywhere with some sample code which uses this construct?
-- Dieter
-- John
--On 2. Juli 2005 15:52:52 +0100 John Poltorak <jp@warpix.org> wrote:
When you are ready to look up (in the hierarchy), then
obj.aq_inner.aq_parent
is the hierarchy parent of "obj".
Well that would be useful if I understood what you meant. Is there a suggested explanation anywhere with some sample code which uses this construct?
This construct returns the *hierarchy* parent vs. the *acquisiton* parent. See Zope Dev Guide for details on Acquistion. -aj
On Sat, Jul 02, 2005 at 05:03:06PM +0200, Andreas Jung wrote:
--On 2. Juli 2005 15:52:52 +0100 John Poltorak <jp@warpix.org> wrote:
When you are ready to look up (in the hierarchy), then
obj.aq_inner.aq_parent
is the hierarchy parent of "obj".
Well that would be useful if I understood what you meant. Is there a suggested explanation anywhere with some sample code which uses this construct?
This construct returns the *hierarchy* parent vs. the *acquisiton* parent. See Zope Dev Guide for details on Acquistion.
I looked and saw numerous broken links but no sample code. It's only sample code which actually creates any meaning to many of these explanations.
-aj
-- John
John Poltorak wrote at 2005-7-2 15:52 +0100:
On Fri, Jul 01, 2005 at 08:15:20PM +0200, Dieter Maurer wrote:
John Poltorak wrote at 2005-6-30 22:27 +0100:
... If I want to generate a list of folders in say the 'groups' folder, how would I change the code above?
You are aware that you will not get a list (but a tree) when you look down from some starting point?
I have problems with the terminology which Zope uses, but I think you understand what I meant.
I know now that I did not understand what you meant... To get the subfolders of a folder, you can use its "tpValues" method. As as you like code: it looks like "folder.tpValues()".
...
When you are ready to look up (in the hierarchy), then
obj.aq_inner.aq_parent
is the hierarchy parent of "obj".
Well that would be useful if I understood what you meant. Is there a suggested explanation anywhere with some sample code which uses this construct?
We are on completely different wavelengths: I do not understand your questions because they are wrapped in (irrelevant) examples. An you do not understand my answer * first, because it is not an answer to your question as I did not correctly understood this * second, because I use abstract terms and hate examples larger than necessary. Had you simply asked: how can I get the list of a folder's subfolders, my answer would have been "folder.tpValues()" and both of us could have been happy.... -- Dieter
participants (4)
-
Andreas Jung -
Dieter Maurer -
John Poltorak -
Nikko Wolf