Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Moved imports around to conform to PEP8. Switched default backend to …
…local so that you are not required to install boto dependency to use the app. local should allow it to work out of the box for everyone. Removed some spacing.
  • Loading branch information
chrisjones-brack3t committed Jun 23, 2011
1 parent 78752a8 commit 7ee45bf
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ajaxuploader/views.py
@@ -1,19 +1,20 @@
from django.http import HttpResponse, HttpResponseBadRequest, Http404
import json

from ajaxuploader.backends.s3 import S3UploadBackend
from django.http import HttpResponse, HttpResponseBadRequest, Http404

from ajaxuploader.backends.local import LocalUploadBackend

class AjaxFileUploader(object):
def __init__(self, backend=None, **kwargs):
if backend is None:
backend = S3UploadBackend
backend = LocalUploadBackend
self._backend = backend(**kwargs)

def __call__(self,request):
return self._ajax_upload(request)

def _ajax_upload(self, request):
if request.method == "POST":
if request.method == "POST":
if request.is_ajax():
# the file is stored raw in the request
upload = request
Expand All @@ -22,7 +23,7 @@ def _ajax_upload(self, request):
# is the "advanced" ajax upload
try:
filename = request.GET['qqfile']
except KeyError:
except KeyError:
return HttpResponseBadRequest("AJAX request not valid")
# not an ajax upload, so it was the "basic" iframe version with
# submission via form
Expand Down

0 comments on commit 7ee45bf

Please sign in to comment.