Hi,

I'm going to make everyone's life miserable again. ;)

In r1279 I added support for "alternative" decorator syntax as used by 
PEAK to lessen the anguish of people still on Python 2.3. This 
unfortunately requires a bit different application of decorator() function.

Before:

   def foo(a):
     def entagle(func)
       def caller(func, *args, **kw):
         func(*args, **kw)
       return decorator(caller)(func)
     return entagle

after:

   def foo(a):
     def entagle(func)
       def caller(func, *args, **kw):
         func(*args, **kw)
       return caller
     return decorator(entagle)

As an added bonus it is also marginally more concise.

While I was at it, I made another change. Until now decorator() added 
*args and **kw to the resulting function signature unless optional 
argument "argsink" was false.
Well, "argsink" is no more. Instead we have a much more powerful (still 
optional) argument "signature" similar in composition to what 
inspect.getargspec() returns, allowing us to define an arbitrary 
signatures (mind, the function being decorated still needs to be able to 
digest this new parameter specification).
To get the beloved care-free will-eat-anything signatures back a helper 
named weak_signature_decorator() is available.

I invite all interested to take a look at decorator.py and 
test_decorator.py. The use of signature in anger can be observed in 
util.bind_args().

Knowing myself I suggest we keep it in trunk for a while (maybe until 
after the sprint and than send it into the wild with nice and shiny 
documentation by it's side).

Cheers,
Simon

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears-trunk
-~----------~----~----~----~------~----~------~--~---

Reply via email to