Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes
plone.memoize.request.RequestMemo Class Reference
Collaboration diagram for plone.memoize.request.RequestMemo:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def __call__

Public Attributes

 arg

Static Public Attributes

string key = 'plone.memoize_request'

Detailed Description

Definition at line 17 of file request.py.


Constructor & Destructor Documentation

def plone.memoize.request.RequestMemo.__init__ (   self,
  arg = 0 
)

Definition at line 21 of file request.py.

00021 
00022     def __init__(self, arg=0):
00023         self.arg = arg

Here is the caller graph for this function:


Member Function Documentation

def plone.memoize.request.RequestMemo.__call__ (   self,
  func 
)

Definition at line 24 of file request.py.

00024 
00025     def __call__(self, func):
00026         def memogetter(*args, **kwargs):
00027             request = None
00028             if isinstance(self.arg, int):
00029                 request = args[self.arg]
00030             else:
00031                 request = kwargs[self.arg]
00032 
00033             annotations = IAnnotations(request)
00034             cache = annotations.get(self.key, _marker)
00035         
00036             if cache is _marker:
00037                 cache = annotations[self.key] = dict()
00038         
00039             key = (func.__module__, func.__name__, 
00040                    args, frozenset(kwargs.items()))
00041             value = cache.get(key, _marker)
00042             if value is _marker:
00043                 value = cache[key] = func(*args, **kwargs)
00044             return value
00045         return memogetter

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 22 of file request.py.

string plone.memoize.request.RequestMemo.key = 'plone.memoize_request' [static]

Definition at line 19 of file request.py.


The documentation for this class was generated from the following file: