Skip to content

Commit

Permalink
Removed DjangoUploadAuthentication, because it isn't used anymore (th…
Browse files Browse the repository at this point in the history
…e new Valums uploader doesn't use Flash)

- fixes django-fiber#65 (for as far as I can tell)
  • Loading branch information
dbunskoek committed Mar 27, 2012
1 parent c1f4b70 commit cf42a61
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 25 deletions.
21 changes: 0 additions & 21 deletions fiber/api/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,3 @@ def challenge(self):
response.status_code = 401

return response


def set_session(request, session_key):
"""
Set the session from this session key. This is used for uploading, because Flash does not support cookies.
"""
engine = import_module(settings.SESSION_ENGINE)
request.session = engine.SessionStore(session_key)


class DjangoUploadAuthentication(DjangoStaffAuthentication):
"""
Authentication for file uploads. Does the same as DjangoStaffAuthentication.
- Uses session id in POST for authentication instead of session cookie.
- The reason is that Flash uploads do not support cookies.
"""
def is_authenticated(self, request):
set_session(request, request.GET.get('sessionid'))

return super(DjangoUploadAuthentication, self).is_authenticated(request)
7 changes: 3 additions & 4 deletions fiber/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@

from piston.resource import Resource

from authentication import DjangoStaffAuthentication, DjangoUploadAuthentication
from authentication import DjangoStaffAuthentication
from handlers import PageHandler, PageContentItemHandler, ImageHandler, FileHandler, FileUploadHandler, ImageUploadHandler, ContentItemHandler
from emitters import jqGridJSONEmitter

auth = DjangoStaffAuthentication()
upload_auth = DjangoUploadAuthentication()

page_handler = Resource(PageHandler, authentication=auth)
page_content_item_handler = Resource(PageContentItemHandler, authentication=auth)
image_handler = Resource(ImageHandler, authentication=auth)
file_handler = Resource(FileHandler, authentication=auth)
file_upload_handler = Resource(FileUploadHandler, authentication=upload_auth)
image_upload_handler = Resource(ImageUploadHandler, authentication=upload_auth)
file_upload_handler = Resource(FileUploadHandler, authentication=auth)
image_upload_handler = Resource(ImageUploadHandler, authentication=auth)
content_item_handler = Resource(ContentItemHandler, authentication=auth)

urlpatterns = patterns('',
Expand Down

0 comments on commit cf42a61

Please sign in to comment.