Re: small proposition for _q_lookup

David Binger <[email protected]>
Newsgroups gmane.comp.web.quixote.user
Message-ID <[email protected]>
On Jul 20, 2005, at 3:38 PM, Shahms King wrote:


> |   obj = self._q_lookup(component, *path)
>
> That would only work if '*path' had exactly the correct number of
> components, no more no less, which is probably not what you'd want.

I was thinking that the _q_lookup, for this particular Directory,
would end in a *arg.

The bottom line is that this behavior is easy to have in quixote
if you override the _q_traverse() of your directory.  That method gets
the path, and you can do whatever you want with it to make
a response.

>
> Probably something closer to:
>
> argspec = inspect.getargspec(self._q_lookup)
> if argspec[1]: # if _q_lookup accepts a variable argument list
> ~  obj = self._q_lookup(component, *path)
> else: # pass component + as much of path as possible
> ~  obj = self._q_lookup(component, *path[:len(argspec[0]) - 2])

The other problem is that the _q_traverse would need to be change
to consume exactly the right number of components from the path.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.