Permalink
Browse files

Added try/except for csrf_exempt for older Django installs.

  • Loading branch information...
1 parent 3d9cd0a commit aca57f5065430bff18f04152a87a2a0fdc99c51b @dwink dwink committed Feb 11, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 tinymce/views.py
View
@@ -10,7 +10,10 @@
from django.utils.translation import ugettext as _
from tinymce.compressor import gzip_compressor
from tinymce.widgets import get_language_config
-from django.views.decorators.csrf import csrf_exempt
+try:
+ from django.views.decorators.csrf import csrf_exempt
+except ImportError:
+ pass
def textareas_js(request, name, lang=None):
"""
@@ -32,7 +35,6 @@ def textareas_js(request, name, lang=None):
return HttpResponse(template.render(context),
content_type="application/x-javascript")
-@csrf_exempt
def spell_check(request):
"""
Returns a HttpResponse that implements the TinyMCE spellchecker protocol.
@@ -70,6 +72,10 @@ def spell_check(request):
return HttpResponse(simplejson.dumps(output),
content_type='application/json')
+try:
+ spell_check = csrf_exempt(spell_check)
+except NameError:
+ pass
def preview(request, name):
"""

0 comments on commit aca57f5

Please sign in to comment.