[Zope] URL traversal

Andy Dustman adustman@comstar.net
Tue, 4 Apr 2000 00:24:55 -0400 (EDT)


I'd like to be able to do something similar to the URL traversal that ZSQL
methods do, but more something like this:

http://localhost/blah/a/b/c/spam

would invoke blah.spam(args=['a','b','c']), i.e. args is a variable-sized
list of each path item between the object and the method in sequence
order.

1) Is there a way to do this short of writing a Product?

2) Having already figured out the answer to #1 was probably "no", I have
tried to write a Product that does the job. It used a helper class,
similar to OFS.Folder.Traverse. My main problem (which I probably have to
punt on) is that I'm trying to use __getattr__ hooks instead of
__getitem__ hooks; I may need to switch to doing the latter to get things
to work.

The test Product (in theory) is essentially a Folder with the above
semantics, because I needed something I could stick DTML Methods and other
things into. This might be useful in general, as well.

3) Is this even a reasonable thing to try to do? I have an existing CGI
script that uses the PATH_INFO like this (mostly; it just takes
everything past a certain point as arguments).

-- 
andy dustman       |     programmer/analyst     |      comstar.net, inc.
telephone: 770.485.6025 / 706.549.7689 | icq: 32922760 | pgp: 0xc72f3f1d
"Therefore, sweet knights, if you may doubt your strength or courage, 
come no further, for death awaits you all, with nasty, big, pointy teeth!"