Jorge Godoy wrote:
> And how can I get 'self' inside the decorator? Inside the class it is
> easy...
>
> The skeleton of what I have is:
>
> ================================================================================
> # decorador.py
> def my_decorator(f, *args, **kw):
> try:
> f(*args, **kw)
Have you considerd:
def my_decorator(f, self, *args, **kw):
try:
f(self, *args, **kw)
This is how we do it in controllers.py (for expose and validate).
Also you may want to decorate it with decorator function straight away.
At least to me it makes it much more readable this way.
> I use tg_errors syntax in function2 because I couldn't get bind_args to work
> :-( (this reduces one functionality and introduces a minor bug in my code, but
> I want to get it finished before I waste more time trying to fix it).
When you have the time, would you mind sharing what didn't work. Thanks.
>> If you are using it inside TG, turbogears.decorator (based on
>> Simionato's work) will integrate better.
>
> Oops. I forgot about it. Is its syntax the same? I'll give it a try.
Yes, it is. The biggest difference is that he uses a class while we use
a function and also provide some more functionality.
Cheers,
Simon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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
-~----------~----~----~----~------~----~------~--~---