Back to index

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

List of all members.

Public Member Functions

def memoize

Static Public Attributes

string key = 'pts.memoize'

Detailed Description

Definition at line 12 of file memoize.py.


Member Function Documentation

Definition at line 16 of file memoize.py.

00016 
00017     def memoize(self, func):
00018         def memogetter(*args, **kwargs):
00019             instance = args[0]
00020             request = args[1]
00021             
00022             annotations = IAnnotations(request)
00023             cache = annotations.get(self.key, _marker)
00024             
00025             if cache is _marker:
00026                 cache = annotations[self.key] = dict()
00027             
00028             key = hash((instance.__class__.__name__, func.__name__, 
00029                         args[1:], frozenset(kwargs.items())),)
00030             value = cache.get(key, _marker)
00031             if value is _marker:
00032                 value = cache[key] = func(*args, **kwargs)
00033             return value
00034         return memogetter

Here is the call graph for this function:


Member Data Documentation

string PlacelessTranslationService.memoize.PTSMemo.key = 'pts.memoize' [static]

Definition at line 14 of file memoize.py.


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