durusmail: quixote-users: small proposition for _q_lookup
small proposition for _q_lookup
2005-07-20
2005-07-20
2005-07-20
2005-07-20
2005-07-20
small proposition for _q_lookup
David Binger
2005-07-20
On Jul 20, 2005, at 12:18 PM, vincent delft wrote:
>
> Why not having the possibility to split the path into
> several variables ?
>
> Would it be difficult to have such in Quixote ?

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)



>
> do you prefer to continue with somethink like:
> Class Calendar(Directory):
>    def _q_lookup(self,comp):
>        day=1
>        month=1
>        for i, value in enumerate(comp.split('/')):
>            if i==0: year=value
>            if i==1: month=value
>            if i==2: day=value
>

This won't work because the component never has any '/' characters.


reply