diff options
author | hrcerqueira <hrcerqueira@gmail.com> | 2010-02-18 00:14:01 +0000 |
---|---|---|
committer | hrcerqueira <hrcerqueira@gmail.com> | 2010-02-18 00:14:01 +0000 |
commit | 710574352dabcab4c710f2795a26501e54329e79 (patch) | |
tree | c34a60217501a582d6fe5b7f0ca655d88bd03c62 /utils/decorators.py | |
parent | 473bdf5773aed8bdd91a16e371f75e628d20511e (diff) | |
download | askbot-710574352dabcab4c710f2795a26501e54329e79.tar.gz askbot-710574352dabcab4c710f2795a26501e54329e79.tar.bz2 askbot-710574352dabcab4c710f2795a26501e54329e79.zip |
Fixed some errors and moved some folders to inside the forum folder.
Diffstat (limited to 'utils/decorators.py')
-rw-r--r-- | utils/decorators.py | 25 |
1 files changed, 0 insertions, 25 deletions
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 - |