def request_cached_property(func):
@property<EOL>@functools.wraps(func)<EOL>def wrapped(self):<EOL><INDENT>cached_value = context.get_for_view(self, func.__name__, UNDEFINED)<EOL>if cached_value is not UNDEFINED:<EOL><INDENT>return cached_value<EOL><DEDENT>value = func(self)<EOL>context.set_for_view(self, func.__name__, value)<EOL>return value<EOL><DEDENT>return wrapped<EOL>
Make the given method a per-request cached property.

    This caches the value on the request context rather than on the object
    itself, preventing problems if the object gets reused across multiple
    requests.