I am assuming you want to decorate a view.

Here is a simple performance logger to know how long a it took for a view
execute. As you can see, you have access to the request object. (not using
traversal in this case)

def perflog_view(func):
    def wrapper(request):
        chrono = time.time()
        output = func(request)
        chrono = time.time() - chrono

        logger.debug("View %s.%s returned in %d ms", func.__module__,
func.__name__, chrono*1000)

        return output
    return wrapper


@perflog_view
def my_view(request):
    # process the request and return some data ...
    return {}


Cheers,
Alex



2012/6/19 Max Avanov <[email protected]>
>
> I need to perform some manipulations with request object inside a
decorator wrapper. How can I access it?
>
> --
> You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
> To view this discussion on the web visit
https://groups.google.com/d/msg/pylons-discuss/-/Kq-R-mZCuDYJ.
> 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/pylons-discuss?hl=en.




--
Alex | twitter.com/alexconrad

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en.

Reply via email to