(request, *args, **kwargs)
| 1 | #the decorator |
| 2 | def myuser_login_required(f): |
| 3 | def wrap(request, *args, **kwargs): |
| 4 | #this check the session if userid key exist, if not it will redirect to login page |
| 5 | if 'userid' not in request.session.keys(): |
| 6 | return HttpResponseRedirect("/mysite/login") |
| 7 | return f(request, *args, **kwargs) |
| 8 | wrap.__doc__=f.__doc__ |
| 9 | wrap.__name__=f.__name__ |
| 10 | return wrap |