From 710574352dabcab4c710f2795a26501e54329e79 Mon Sep 17 00:00:00 2001 From: hrcerqueira Date: Thu, 18 Feb 2010 00:14:01 +0000 Subject: Fixed some errors and moved some folders to inside the forum folder. --- utils/decorators.py | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 utils/decorators.py (limited to 'utils/decorators.py') diff --git a/utils/decorators.py b/utils/decorators.py deleted file mode 100644 index e4e7acb3..00000000 --- a/utils/decorators.py +++ /dev/null @@ -1,25 +0,0 @@ -from django.http import HttpResponse, HttpResponseForbidden, Http404 -from django.utils import simplejson - -def ajax_login_required(view_func): - def wrap(request,*args,**kwargs): - if request.user.is_authenticated(): - return view_func(request,*args,**kwargs) - else: - json = simplejson.dumps({'login_required':True}) - return HttpResponseForbidden(json,mimetype='application/json') - return wrap - -def ajax_method(view_func): - def wrap(request,*args,**kwargs): - if not request.is_ajax(): - raise Http404 - retval = view_func(request,*args,**kwargs) - if isinstance(retval, HttpResponse): - retval.mimetype = 'application/json' - return retval - else: - json = simplejson.dumps(retval) - return HttpResponse(json,mimetype='application/json') - return wrap - -- cgit v1.2.3-1-g7c22