diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-02-02 20:48:41 -0500 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-02-02 20:48:41 -0500 |
commit | 955f0853655cd499a12f69ca35768802ddbbac38 (patch) | |
tree | dee4116cbd68064d4d314f913daaaeba748ac90a /mediawiki/middleware.py | |
parent | c269397bbc0f9716fa47ddb311cdd37d3954859d (diff) | |
download | askbot-955f0853655cd499a12f69ca35768802ddbbac38.tar.gz askbot-955f0853655cd499a12f69ca35768802ddbbac38.tar.bz2 askbot-955f0853655cd499a12f69ca35768802ddbbac38.zip |
remove experimental and unused files, small cleanups
Diffstat (limited to 'mediawiki/middleware.py')
-rw-r--r-- | mediawiki/middleware.py | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/mediawiki/middleware.py b/mediawiki/middleware.py deleted file mode 100644 index a46f486a..00000000 --- a/mediawiki/middleware.py +++ /dev/null @@ -1,57 +0,0 @@ -from django.contrib import auth -from django.core.exceptions import ImproperlyConfigured -from django.conf import settings -import logging -import traceback -import sys - -class IncludeVirtualAuthenticationMiddleware(object): - def process_request(self,request): - """in this type of authentication the mw session token is passed via - "session" request parameter and authentication happens on every - request - """ - logging.debug('trying include virtual milldeware') - if not hasattr(request,'user'): - raise ImproperlyConfigured( - "The include virtual mediawiki authentication middleware requires the" - " authentication middleware to be installed. Edit your" - " MIDDLEWARE_CLASSES setting to insert" - " 'django.contrib.auth.middleware.AuthenticationMiddleware'" - " before the IncludeVirtualAuthenticationMiddleware class." - ) - - session = None - request.is_include_virtual = False - if request.is_ajax(): - logging.debug('have ajax request') - cookie_name = settings.MEDIAWIKI_SESSION_COOKIE_NAME - if cookie_name in request.COOKIES: - session = request.COOKIES[cookie_name] - logging.debug('ajax call has session %s' % session) - else: - logging.debug('dont have cookie') - else: - if request.REQUEST.has_key('session'): - session = request.REQUEST['session'] - request.is_include_virtual = True - logging.debug('I am virtual') - if request.REQUEST.get('was_posted','false') == 'true': - data = request.GET.copy() - data['recaptcha_ip_field'] = request.META['REMOTE_ADDR'] - request.GET = data - logging.debug('REQUEST is now %s' % str(request.GET)) - user = auth.authenticate(token=session) #authenticate every time - if user: - request.user = user - auth.login(request,user) - #else I probably need to forbid access - #raise ImproperlyConfigured( - # "The include virtual mediawiki authentication middleware requires the" - # "'session' request parameter set in the including document" - #) - - def process_exception(self,request,exception): - exceptionType, exceptionValue, exceptionTraceback = sys.exc_info() - logging.debug('\n'.join(traceback.format_tb(exceptionTraceback))) - logging.debug('have exception %s %s' % (exceptionType,exceptionValue)) |