(podcast_pk, user_pk, client_uid, ref_url=None)
subscribes user to the current podcast on one client

    Takes syned devices into account.
subscribes user to the current podcast on one client
subscribes user to the current podcast on one client
def subscribe(podcast_pk, user_pk, client_uid, ref_url=None):
    """subscribes user to the current podcast on one client

    Takes syned devices into account."""
    podcast = Podcast.objects.get(pk=podcast_pk)

    User = get_user_model()
    user = User.objects.get(pk=user_pk)

    client = user.client_set.get(uid=client_uid)

    ref_url = ref_url or podcast.url
    now = datetime.utcnow()
    clients = _affected_clients(client)

    # fully execute subscriptions, before firing events
    changed = list(_perform_subscribe(podcast, user, clients, now, ref_url))
    _fire_events(podcast, user, changed, True)
def subscribe ( podcast_pk , user_pk , client_uid , ref_url = None ) : podcast = Podcast . objects . get ( pk = podcast_pk ) User = get_user_model ( ) user = User . objects . get ( pk = user_pk ) client = user . client_set . get ( uid = client_uid ) ref_url = ref_url or podcast . url now = datetime . utcnow ( ) clients = _affected_clients ( client ) # fully execute subscriptions, before firing events changed = list ( _perform_subscribe ( podcast , user , clients , now , ref_url ) ) _fire_events ( podcast , user , changed , True )