示例#1
0
def get_recommended_content_for_user(account,
                                     record_views=False,
                                     src=SRC_EXPLORE):
    """Wrapper around get_recommended_content() that fills in user info.

    If record_views == True, the srs will be noted in the user's preferences
    to keep from showing them again too soon.

    Returns a list of ExploreItems.

    """
    prefs = AccountSRPrefs.for_user(account)
    recs = get_recommended_content(prefs, src)
    if record_views:
        # mark as seen so they won't be shown again too soon
        sr_data = {r.sr: r.src for r in recs}
        AccountSRFeedback.record_views(account, sr_data)
    return recs
示例#2
0
def get_recommended_content_for_user(account,
                                     record_views=False,
                                     src=SRC_EXPLORE):
    """Wrapper around get_recommended_content() that fills in user info.

    If record_views == True, the srs will be noted in the user's preferences
    to keep from showing them again too soon.

    Returns a list of ExploreItems.

    """
    prefs = AccountSRPrefs.for_user(account)
    recs = get_recommended_content(prefs, src)
    if record_views:
        # mark as seen so they won't be shown again too soon
        sr_data = {r.sr: r.src for r in recs}
        AccountSRFeedback.record_views(account, sr_data)
    return recs
示例#3
0
def get_recommended_content_for_user(account,
                                     record_views=False,
                                     src=SRC_EXPLORE,
                                     settings=None):
    """Wrapper around get_recommended_content() that fills in user info.

    If record_views == True, the srs will be noted in the user's preferences
    to keep from showing them again too soon.

    settings is an ExploreSettings object that controls what types of content
    will be included.

    Returns a list of ExploreItems.

    """
    prefs = AccountSRPrefs.for_user(account)
    settings = settings or ExploreSettings()
    recs = get_recommended_content(prefs, src, settings)
    if record_views:
        # mark as seen so they won't be shown again too soon
        sr_data = {r.sr: r.src for r in recs}
        AccountSRFeedback.record_views(account, sr_data)
    return recs
示例#4
0
def get_recommended_content_for_user(account,
                                     record_views=False,
                                     src=SRC_EXPLORE,
                                     settings=None):
    """Wrapper around get_recommended_content() that fills in user info.

    If record_views == True, the srs will be noted in the user's preferences
    to keep from showing them again too soon.

    settings is an ExploreSettings object that controls what types of content
    will be included.

    Returns a list of ExploreItems.

    """
    prefs = AccountSRPrefs.for_user(account)
    settings = settings or ExploreSettings()
    recs = get_recommended_content(prefs, src, settings)
    if record_views:
        # mark as seen so they won't be shown again too soon
        sr_data = {r.sr: r.src for r in recs}
        AccountSRFeedback.record_views(account, sr_data)
    return recs