/usr/share/pyshared/lazr/restful/jsoncache.py is in python-lazr.restful 0.19.3-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | # Copyright 2008 Canonical Ltd. All rights reserved.
#
"""A class for storing resources where they can be seen by a template."""
__metaclass__ = type
__all__ = [
'JSONRequestCache'
]
from lazr.restful.interfaces import (
IJSONRequestCache, LAZR_WEBSERVICE_NS)
from zope.component import adapts
from zope.interface import implements
from zope.publisher.interfaces import IApplicationRequest
class JSONRequestCache:
"""Default implementation for `IJSONRequestCache`."""
implements(IJSONRequestCache)
adapts(IApplicationRequest)
LAZR_OBJECT_JSON_CACHE = ("%s.object-json-cache"
% LAZR_WEBSERVICE_NS)
LAZR_LINK_JSON_CACHE = ("%s.link-json-cache"
% LAZR_WEBSERVICE_NS)
def __init__(self, request):
"""Initialize with a request."""
self.objects = request.annotations.setdefault(
self.LAZR_OBJECT_JSON_CACHE, {})
self.links = request.annotations.setdefault(
self.LAZR_LINK_JSON_CACHE, {})
|