Re: small proposition for _q_lookup

vincent delft <[email protected]>
Newsgroups gmane.comp.web.quixote.user
Message-ID <[email protected]>
--- David Binger <[email protected]> wrote:

> One way to do this is to override the _q_traverse
> and have
> it call your _q_lookup the way you want, instead of
> just
> passing the first component on the rest of the path.
> 
> Maybe, in _q_traverse(), you would want
> 
>    obj = self._q_lookup(component, *path)
> 
> instead of
> 
>    obj = self._q_lookup(component)
> 
> 
I've done:
"
obj= self._q_lookup(component, *path)
path=None 
"
the path=None is required to mentione that we are at
the end of the "traverse" process.

In my _q_lookup, I can do:
def _q_lookup(self,year,month=1,day=1):
    ....
(in fact year is my component)

This method still allows me to have other methods in
my Calendar class like "edit", "delete".
Then I could have the following urls:
http://localhost/calendar/edit?year=2005&month=07&day=20
http://localhost/calendar/delete?year=2005&month=07&day=20
and
http://localhost/calendar/2005/07/20

much more elegant, no?

It sounds very simple. Too simple.
Does someone have an idea why it was not implemented ?
I've surely missed something.

Thanks David.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com
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.