mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
I believe this Context wrapping is still preserved. See this django ticket: https://code.djangoproject.com/ticket/28125. Reverting this fixes the error, so I'm assuming this is that type of render.
This commit is contained in:
parent
36b0823786
commit
553483ce52
1 changed files with 3 additions and 3 deletions
|
@ -7,7 +7,7 @@ from utils import log as logging
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
from django.template import Template
|
from django.template import Template, Context
|
||||||
from apps.statistics.rstats import round_time
|
from apps.statistics.rstats import round_time
|
||||||
from utils import json_functions as json
|
from utils import json_functions as json
|
||||||
|
|
||||||
|
@ -121,11 +121,11 @@ class SQLLogToConsoleMiddleware:
|
||||||
query['sql'] = re.sub(r'DELETE', '~FR~SBDELETE', query['sql'])
|
query['sql'] = re.sub(r'DELETE', '~FR~SBDELETE', query['sql'])
|
||||||
t = Template("{% for sql in sqllog %}{% if not forloop.first %} {% endif %}[{{forloop.counter}}] ~FC{{sql.time}}s~FW: {{sql.sql|safe}}{% if not forloop.last %}\n{% endif %}{% endfor %}")
|
t = Template("{% for sql in sqllog %}{% if not forloop.first %} {% endif %}[{{forloop.counter}}] ~FC{{sql.time}}s~FW: {{sql.sql|safe}}{% if not forloop.last %}\n{% endif %}{% endfor %}")
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
logging.debug(t.render({
|
logging.debug(t.render(Context({
|
||||||
'sqllog': queries,
|
'sqllog': queries,
|
||||||
'count': len(queries),
|
'count': len(queries),
|
||||||
'time': time_elapsed,
|
'time': time_elapsed,
|
||||||
}))
|
})))
|
||||||
times_elapsed = {
|
times_elapsed = {
|
||||||
'sql': sum([float(q['time'])
|
'sql': sum([float(q['time'])
|
||||||
for q in queries if not q.get('mongo') and
|
for q in queries if not q.get('mongo') and
|
||||||
|
|
Loading…
Add table
Reference in a new issue