Did I find the right examples for you? yes no

All Samples(0)  |  Call(0)  |  Derive(0)  |  Import(0)

src/s/h/shareabouts-api-HEAD/src/sa_api_v1/views.py   shareabouts-api(Download)
def raise_error_if_not_authenticated(view, request):
    # TODO: delete this
    if getattr(request, 'user', None) is None:
        # Probably happens only in tests that have forgotten to set the user.
        raise permissions._403_FORBIDDEN_RESPONSE
        if username and (self.view.allowed_username == username):
            return
        raise permissions._403_FORBIDDEN_RESPONSE
 
 
        from .apikey_v1.auth import KEY_HEADER
        if KEY_HEADER in self.view.request.META:
            raise permissions._403_FORBIDDEN_RESPONSE
 
        return super(IsOwnerOrSuperuserWithoutApiKey, self).check_permission(user)
                return
 
        raise permissions._403_FORBIDDEN_RESPONSE