##// END OF EJS Templates
Added more margins to SW theme
Added more margins to SW theme

File last commit:

r721:1814d7a8 default
r943:e8b16c78 default
Show More
profiler.py
26 lines | 904 B | text/x-python | PythonLexer
neko259
Added missing profiler script. Removed user's last access time, now getting it from the user's last post time. Added more info to the settings (user's registration and last access time).
r197 import sys
from cStringIO import StringIO
from django.conf import settings
neko259
Moved some settings to boards.settings
r333 import line_profiler
neko259
Added missing profiler script. Removed user's last access time, now getting it from the user's last post time. Added more info to the settings (user's registration and last access time).
r197
neko259
Small code cleanups
r721 class ProfilerMiddleware():
def __init__(self):
self.profiler = None
neko259
Added missing profiler script. Removed user's last access time, now getting it from the user's last post time. Added more info to the settings (user's registration and last access time).
r197 def process_view(self, request, callback, callback_args, callback_kwargs):
if settings.DEBUG and 'prof' in request.GET:
self.profiler = line_profiler.LineProfiler()
self.profiler.add_function(callback)
self.profiler.enable()
args = (request,) + callback_args
return callback(*args, **callback_kwargs)
def process_response(self, request, response):
if settings.DEBUG and 'prof' in request.GET:
out = StringIO()
old_stdout, sys.stdout = sys.stdout, out
self.profiler.print_stats()
sys.stdout = old_stdout
response.content = '<pre>%s</pre>' % out.getvalue()
return response