Re: Sample Custom Decorator

2011-10-11 Thread Kurtis Mullins
Thank you so much for the awesome clarification. It makes a lot more sense. I'm going to read those docs and play around with the code just to feel comfortable. I appreciate the great answer! On Tue, Oct 11, 2011 at 8:11 PM, Steven Cummings wrote: > The wrapper that you typically see is the new

Re: Sample Custom Decorator

2011-10-11 Thread Steven Cummings
The wrapper that you typically see is the new function that is returned. This usually invokes the original, given function in addition to some extra ("decorating") logic around that call. Based on that question it sounds like you might want to check out some introductory material on decorators [1][

Re: Sample Custom Decorator

2011-10-11 Thread Kurtis Mullins
Thanks Fred! I tried to look through your code and understand what's going on -- but I'm still at a loss. I'm guessing I need to look at the Django source to see what should be returned when you hit a URL and what is passed. The wrapper is confusing me and I've seen that in Django code as well. I'm

RE: Sample Custom Decorator

2011-10-11 Thread Sells, Fred
I'm no expert but this is what I built to log all user actions -- warts and all def decorate(func): ##print 'Decorating %s...' % func.__name__ def wrapped( *args, **kwargs): request = args[0] if len(args)>1: command=str(args[1]) else: command = ''