Re: how to find the last decorator of a chain

2009-06-02 Thread Aahz
In article , Gabriel wrote: > >I have something like this: > >@render(format="a") >@render(format="b") >@ >def view(format, data): > return data > >Each render will do something with 'data' if format match, and nothing >if not. > >But if there is no more renders to eval, the last one is the

Re: how to find the last decorator of a chain

2009-05-31 Thread samwyse
On May 30, 6:16 pm, Gabriel wrote: > I have something like this: > > @render(format="a") > @render(format="b") > @ > def view(format, data): >   return data > In my understanding this equivalent to: > > render('a', >  render('b', >   view(***))) Not quite. 'render' is a function of one arg

Re: how to find the last decorator of a chain

2009-05-30 Thread Benjamin Peterson
Gabriel opensuse.org> writes: > In my understanding this equivalent to: > > render('a', > render('b', > view(***))) > > Is there any way to know, in this case, that 'a' is the 'default' format? You could set an attribute on the function indicating the default. -- http://mail.python.or

how to find the last decorator of a chain

2009-05-30 Thread Gabriel
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hi, I have something like this: @render(format="a") @render(format="b") @ def view(format, data): return data Each render will do something with 'data' if format match, and nothing if not. But if there is no more renders to eval, the last o