def permission_required(perm, login_url=None):
    return user_passes_test(lambda u: u.has_perm(perm), login_url=login_url)
Decorator for views that checks whether a user has a particular permission
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/contrib/auth/decorators.py/permission_required