Skip to content

Commit

Permalink
- changed middeleware to collect data from pannels and store it in th…
Browse files Browse the repository at this point in the history
…e cache backend
  • Loading branch information
gumuz committed Jun 10, 2011
1 parent 0541ce2 commit c7deeb1
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions debug_toolbar/middleware.py
Expand Up @@ -128,15 +128,26 @@ def process_response(self, request, response):
{'redirect_to': redirect_to}
)
response.cookies = cookies
if 'gzip' not in response.get('Content-Encoding', '') and \
del self.__class__.debug_toolbars[ident]
if 'gzip' not in response.get('Content-Encoding', '') and\
response.get('Content-Type', '').split(';')[0] in _HTML_TYPES:
data = {"SESSION_ID": request.session.session_key}
for panel in toolbar.panels:
panel.process_response(request, response)
response.content = replace_insensitive(
smart_unicode(response.content),
self.tag,
smart_unicode(toolbar.render_toolbar() + self.tag))
if response.get('Content-Length', None):
response['Content-Length'] = len(response.content)
del self.__class__.debug_toolbars[ident]
data[panel.name] = panel.get_data()

from debug_toolbar.utils.backend import CacheBackend
cb = CacheBackend()
cb.store(data)

for i in range(cb.last()):
print i, cb.get(i)

This comment has been minimized.

Copy link
@joeribekker

joeribekker Jun 10, 2011

Member

print statements are a poor man's debugger :-(



# response.content = replace_insensitive(
# smart_unicode(response.content),
# self.tag,
# smart_unicode(toolbar.render_toolbar() + self.tag))
# if response.get('Content-Length', None):
# response['Content-Length'] = len(response.content)
return response

0 comments on commit c7deeb1

Please sign in to comment.