예제 #1
0
def cache_page(f, *args, **kwargs):
    """Version of the cache_page decorator that does not return a cache
    if ENABLE_CACHING is set to False in the settings module. Means
    the decorator can be used regardless of cache availability.
    """
    if getattr(settings, 'ENABLE_CACHING', True):
        return _cache_page(f, *args, **kwargs)
    else:
        return f
예제 #2
0
def cache_page(*args, **kwargs):
    '''
    Same as django's ``cache_page`` decorator, but wraps the view into
    ``vary_on_flavour`` decorator before. Makes it possible to serve multiple
    flavours without getting into trouble with django's caching that doesn't
    know about flavours.
    '''
    decorator = _cache_page(*args, **kwargs)
    def flavoured_decorator(func):
        return decorator(vary_on_flavour(func))
    return flavoured_decorator
예제 #3
0
def cache_page(*args, **kwargs):
    '''
    Same as django's ``cache_page`` decorator, but wraps the view into
    ``vary_on_flavour`` decorator before. Makes it possible to serve multiple
    flavours without getting into trouble with django's caching that doesn't
    know about flavours.
    '''
    decorator = _cache_page(*args, **kwargs)

    def flavoured_decorator(func):
        return decorator(vary_on_flavour(func))

    return flavoured_decorator
예제 #4
0
 def flavoured_decorator(func):
     return vary_on_flavour_request(_cache_page(*args, **kwargs)(vary_on_flavour_response(func)))