def etag_cache_keygen(key_obj, private=False): request._http_private = private args = sorted(set(request.args.items())) # jquery where is your god now?!? args = filter(lambda (k, v): k != '_', args) request._http_etag = cache_hash(args, current_user, key_obj, get_locale()) if request.if_none_match == request._http_etag: raise NotModified()
def etag_cache_keygen(*keys): if not request._http_cache: return args = sorted(set(request.args.items())) # jquery where is your god now?!? args = filter(lambda (k, v): k != '_', args) request._http_etag = cache_hash(args, current_user, keys, get_locale()) if request.if_none_match == request._http_etag: raise NotModified()
def etag_cache_keygen(*keys): if not request._http_cache: return args = sorted(set(request.args.items())) # jquery where is your god now?!? args = filter(lambda (k, v): k != '_', args) cache_parts = [args, keys] if current_user.is_authenticated(): cache_parts.extend( (current_user, request.authz_sources, request.authz_lists)) request._http_etag = cache_hash(*cache_parts) if request.if_none_match == request._http_etag: raise NotModified()
def etag_cache_keygen(*keys): if not request._http_cache: return args = sorted(set(request.args.items())) # jquery where is your god now?!? args = filter(lambda (k, v): k != '_', args) cache_parts = [args, keys] if authz.logged_in(): cache_parts.extend((request.auth_roles, request.auth_sources, request.auth_lists)) request._http_etag = cache_hash(*cache_parts) if request.if_none_match == request._http_etag: raise NotModified()
def enable_cache(vary_user=False, vary=None, server_side=True): args = sorted(set(request.args.items())) # jquery where is your god now?!? args = filter(lambda (k, v): k != '_', args) cache_parts = [args, vary] if vary_user: cache_parts.extend((request.auth_roles)) request._http_cache = get_config('CACHE') request._http_etag = cache_hash(*cache_parts) request._http_server = server_side if request.if_none_match == request._http_etag: raise NotModified()
def enable_cache(vary_user=False, vary=None, server_side=True): args = sorted(set(request.args.items())) # jquery where is your god now?!? args = filter(lambda (k, v): k != '_', args) cache_parts = [args, vary] if vary_user: cache_parts.extend((request.authz.roles)) request._http_cache = get_config('CACHE') request._http_etag = cache_hash(*cache_parts) request._http_server = server_side if request.if_none_match == request._http_etag: raise NotModified()
def enable_cache(vary_user=True, vary=None, server_side=False): """Enable caching in the context of a view. If desired, instructions on the cache parameters can be included, such as if the data is fit for public caches (default: no, vary_user) and what values to include in the generation of an etag. """ args = sorted(set(request.args.items())) # jquery where is your god now?!? args = filter(lambda (k, v): k != '_', args) cache_parts = [args, vary] if vary_user: cache_parts.extend((request.authz.roles)) request._http_private = True request._http_cache = get_config('CACHE') request._http_etag = cache_hash(*cache_parts) if request.if_none_match == request._http_etag: raise NotModified()