[Twisted-web] Page navigation: a cry for help

James Y Knight twisted-web@twistedmatrix.com
Tue, 27 Jan 2004 19:13:52 -0500


On Jan 27, 2004, at 4:55 PM, Michal Pasternak wrote:
> Christopher Armstrong [Tue, Jan 27, 2004 at 05:39:19PM -0500]:
>> What kind of storage are you using? If it's a filesystem that mirrors
>> the URL structure, you could just look up a modified request.prepath 
>> in
>> your file system and look at sibling pages.
>
> I am not using any filesystem. Whole structure is made up of classess 
> in the
> code. Currently I have written a custom class, which is a basic of all
> classess I create:
>
> ... and I can achieve both goals with it, but I don't know if it is 
> the best
> method available.

If you use nevow, it does this for you. request.resources is a list 
containing all the resources called on the way down. So, in getChild, 
request.resources[-1] is your parent. In render, i believe 
request.resources[-2] will be your parent.

If you're not using nevow, perhaps you should be. :)

James