(self, request, scope)
Get the scope object
Get the scope object
Get the scope object
def get_scope(self, request, scope):
        """Get the scope object"""
        if scope == "account":
            return None

        if scope == "device":
            uid = request.GET.get("device", "")
            return request.user.client_set.get(uid=uid)

        episode_url = request.GET.get("episode", "")
        podcast_url = request.GET.get("podcast", "")

        if scope == "podcast":
            return get_object_or_404(Podcast, urls__url=podcast_url)

        if scope == "episode":
            podcast = get_object_or_404(Podcast, urls__url=podcast_url)
            return get_object_or_404(Episode, podcast=podcast, urls__url=episode_url)

        raise RequestException("undefined scope %s" % scope)
def get_scope ( self , request , scope ) : if scope == "account" : return None if scope == "device" : uid = request . GET . get ( "device" , "" ) return request . user . client_set . get ( uid = uid ) episode_url = request . GET . get ( "episode" , "" ) podcast_url = request . GET . get ( "podcast" , "" ) if scope == "podcast" : return get_object_or_404 ( Podcast , urls__url = podcast_url ) if scope == "episode" : podcast = get_object_or_404 ( Podcast , urls__url = podcast_url ) return get_object_or_404 ( Episode , podcast = podcast , urls__url = episode_url ) raise RequestException ( "undefined scope %s" % scope )