- func, args, kwargs = resolve(path)
- parsed = urlparse(path)
-
- # Reuse the original request, but reset some attributes.
- request.META['PATH_INFO'] = request.path_info = \
- request.path = parsed.path
- request.META['QUERY_STRING'] = parsed.query
- request.ssi_vars_needed = {}
-
- content = func(request, *args, **kwargs).content.decode('ascii')
- content = process_content(content)
- if DEBUG_VERBOSE:
+ content = None
+ for cache in get_caches():
+ content = cache.get(path)
+ if content is not None:
+ break
+ if content is None:
+ func, args, kwargs = resolve(path)
+ parsed = urlparse(path)
+
+ # Reuse the original request, but reset some attributes.
+ request.META['PATH_INFO'] = request.path_info = \
+ request.path = parsed.path
+ request.META['QUERY_STRING'] = parsed.query
+ request.ssi_vars_needed = {}
+
+ subresponse = func(request, *args, **kwargs)
+ # FIXME: we should deal directly with bytes here.
+ if subresponse.streaming:
+ content = b"".join(subresponse.streaming_content)
+ else:
+ content = subresponse.content
+ content = process_content(content.decode('utf-8'))
+ if conf.RENDER_VERBOSE: