fixed master file generation command
[redakcja.git] / apps / filebrowser / views.py
index 7870b9d..6c1c92d 100644 (file)
@@ -15,6 +15,7 @@ from django import forms
 from django.core.urlresolvers import reverse
 from django.core.exceptions import ImproperlyConfigured
 from django.dispatch import Signal
+from django.views.decorators.csrf import csrf_exempt
 
 from django.utils.encoding import smart_unicode, smart_str
 
@@ -55,7 +56,7 @@ def browse(request):
         request.user.message_set.create(message=msg)
         if directory is None:
             # The DIRECTORY does not exist, raise an error to prevent eternal redirecting.
-            raise ImproperlyConfigured(_("Error finding upload directory. Maybe it does not exist?"))
+            raise ImproperlyConfigured(_("Error finding upload directory: %s. Maybe it does not exist?" % os.path.join(MEDIA_ROOT, DIRECTORY)))
         redirect_url = reverse("fb_browse") + query_helper(query, "", "dir")
         return HttpResponseRedirect(redirect_url)
     abs_path = os.path.join(MEDIA_ROOT, DIRECTORY, path)
@@ -186,6 +187,7 @@ def mkdir(request):
 mkdir = staff_member_required(never_cache(mkdir))
 
 
+@csrf_exempt
 def upload(request):
     """
     Multipe File Upload.
@@ -217,6 +219,7 @@ def upload(request):
 upload = staff_member_required(never_cache(upload))
 
 
+@csrf_exempt
 def _check_file(request):
     """
     Check if file already exists on the server.
@@ -272,7 +275,7 @@ def _upload_file(request):
             # POST UPLOAD SIGNAL
             filebrowser_post_upload.send(sender=request, path=request.POST.get('folder'), file=FileObject(os.path.join(DIRECTORY, folder, filedata.name)))
     return HttpResponse('True')
-_upload_file = flash_login_required(_upload_file)
+_upload_file = csrf_exempt(flash_login_required(_upload_file))
 
 
 # delete signals