Permalink
Browse files

Use SetRequestDebugMiddleware from django tools v0.24.8.pre

to set request.debug
jedie/django-tools@f3e3df0
  • Loading branch information...
1 parent 41027b4 commit bab673621152d33d48fdef86e21b336c38f99b0a @jedie committed Aug 22, 2012
@@ -4,7 +4,7 @@
{% block title %}PyLucid - {{ title }}{% endblock %}
{% block extrahead %}{{ block.super }}
-{% if debug %}<!-- ./apps/pylucid/templates/admin/base_site.html extrahead block START -->{% endif %}
+{% if request.debug %}<!-- ./apps/pylucid/templates/admin/base_site.html extrahead block START -->{% endif %}
{% compress js %}
<script type="text/javascript">
var PyLucid_media_url="{{ STATIC_URL }}PyLucid/";
@@ -14,19 +14,20 @@
<script type="text/javascript" src="{{ STATIC_URL }}PyLucid/pylucid_js_tools.js" onerror="JavaScript:alert('Error loading file ['+this.src+'] !');"></script>
<script type="text/javascript" src="{{ STATIC_URL }}PyLucid/codemirror/codemirror_min.js" onerror="JavaScript:alert('Error loading file ['+this.src+'] !');"></script>
<script type="text/javascript" src="{{ STATIC_URL }}PyLucid/jwysiwyg/jquery.wysiwyg.js" onerror="JavaScript:alert('Error loading file ['+this.src+'] !');"></script>
-{% if debug %}
+{{ debug }}
+{% if request.debug %}
<script type="text/javascript">var debug=true;log("debug is on");</script>
{% else %}
<script type="text/javascript">var debug=false;</script>
{% endif %}
{% endcompress %}
{% include "admin_menu/includes/superfish_extrahead.html" %}
-{% if debug %}<!-- ./apps/pylucid/templates/admin/base_site.html extrahead block END -->{% endif %}
+{% if request.debug %}<!-- ./apps/pylucid/templates/admin/base_site.html extrahead block END -->{% endif %}
{% endblock extrahead %}
{% block extrastyle %}{% compress css %}{{ block.super }}
-{% if debug %}<!-- ./apps/pylucid/templates/admin/base_site.html extrastyle block START -->{% endif %}
+{% if request.debug %}<!-- ./apps/pylucid/templates/admin/base_site.html extrastyle block START -->{% endif %}
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}PyLucid/jwysiwyg/jquery.wysiwyg.css" onerror="JavaScript:alert('Error loading file ['+this.href+'] !');" />
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}PyLucid/pylucid_admin.css" onerror="JavaScript:alert('Error loading file ['+this.href+'] !');" />
<style type="text/css">
@@ -73,7 +74,7 @@
}
</style>
{% lucidTag extrahead filepath="pygments.css" %}
-{% if debug %}<!-- ./apps/pylucid/templates/admin/base_site.html extrastyle block END -->{% endif %}
+{% if request.debug %}<!-- ./apps/pylucid/templates/admin/base_site.html extrastyle block END -->{% endif %}
{% endcompress %}
{% endblock extrastyle %}
@@ -1,4 +1,4 @@
-{% if debug %}<!-- pylucid plugin ./admin_menu/includes/superfish_extrahead.html START -->{% endif %}
+{% if request.debug %}<!-- pylucid plugin ./admin_menu/includes/superfish_extrahead.html START -->{% endif %}
{% compress css %}
<link rel="stylesheet" type="text/css" media="screen" href="{{ STATIC_URL }}PyLucid/superfish/superfish.css" onerror="JavaScript:alert('Error loading file ['+this.href+'] !');" />
<link rel="stylesheet" type="text/css" media="screen" href="{{ STATIC_URL }}PyLucid/superfish/pylucid_superfish.css" onerror="JavaScript:alert('Error loading file ['+this.href+'] !');" />
@@ -22,4 +22,4 @@
<script type="text/javascript" src="{{ STATIC_URL }}PyLucid/superfish/pylucid_superfish.js" onerror="JavaScript:alert('Error loading file ['+this.href+'] !');" ></script>
{% endcompress %}
-{% if debug %}<!-- pylucid plugin ./admin_menu/includes/superfish_extrahead.html END -->{% endif %}
+{% if request.debug %}<!-- pylucid plugin ./admin_menu/includes/superfish_extrahead.html END -->{% endif %}
@@ -101,6 +101,9 @@ def _pkg_path(obj):
# Save process informations. More info: https://github.com/jedie/django-processinfo
'django_processinfo.middlewares.django_processinfo.ProcessInfoMiddleware',
+ # Set request.debug bool value:
+ 'django_tools.debug.middlewares.SetRequestDebugMiddleware',
+
# Block banned IP addresses and delete old pylucid.models.BanEntry items:
'pylucid_project.middlewares.ip_ban.IPBanMiddleware',
@@ -197,7 +200,6 @@ def _pkg_path(obj):
# dictionary of items to be merged into the context.
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
- "django.core.context_processors.debug", # Add 'debug' info in context
"django.core.context_processors.i18n",
"django.core.context_processors.request", # Add request object to context
"django.core.context_processors.static", # Add STATIC_URL to context

0 comments on commit bab6736

Please sign in to comment.