how to find the last decorator of a chain

Gabriel gabriel at opensuse.org
Sun May 31 01:16:10 CEST 2009


-----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 one is the default,
and must run even if the format doesn't match.

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?

PS: the number of renders could be 1 or more.

- --
Kind regards.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEAREIAAYFAkohvjoACgkQNHr4BkRe3pJZQgCgqxL7Qq7/vqDQMLkGQs5emWgH
nbMAn2vzY0xGjG2xhOkxAf8hmERc8R5r
=wWbB
-----END PGP SIGNATURE-----



More information about the Python-list mailing list