Пример #1
0
 def _wrapper(*args, **kwargs):
     # if there are kwargs, skip caching
     if kwargs:
         return f(*args, **kwargs)
     else:
         # create a unique key
         k = (f, args)
         cache = ContextManager.setdefault('request_cache', {})
         if k not in cache:
             cache[k] = f(*args)
         return cache[k]
Пример #2
0
 def _wrapper(*args, **kwargs):
     # if there are kwargs, skip caching
     if kwargs:
         return f(*args, **kwargs)
     else:
         # create a unique key
         k = (f, args)
         cache = ContextManager.setdefault('request_cache', {})
         if k not in cache:
             cache[k] = f(*args)
         return cache[k]
Пример #3
0
 def wrapper(*args, **kwargs):
     func = partial(f, *args, **kwargs)
     if not ContextManager.get('currentRH', None):
         return func()
     ContextManager.setdefault('afterCommitQueue', []).append(func)
Пример #4
0
 def wrapper(*args, **kwargs):
     func = partial(f, *args, **kwargs)
     if not ContextManager.get('currentRH', None):
         return func()
     ContextManager.setdefault('afterCommitQueue', []).append(func)