hadrien/pyramid_caching — pull request #8 by deuxpi (2014-05-27 17:45:51+00:00)
Title: Fetch the metrics utility from thread-local data

If the cache events do not have access to the current request object, get the current metrics utility directly from pyramid_metrics, which would get it from a thread-local data structure.

@pior @hadrien It will still try first to get the current request from the event itself. This makes it a bit easier to unit test because we can inject the Request object and it makes it clear that this request defines the context of the event. Should we still keep this or is it totally redundant?

In any case, pyramid_metrics has to provide a get_current_metrics that is not difficult to implement.