Exemplo n.º 1
0
def sharing_box(context):
    request = context['request']

    services = sharing.get_services()

    c = dict(context.items())
    c.update({'request': request, 'user': request.user, 'services': services})
    return c
Exemplo n.º 2
0
def sharing_widget(context, obj, condensed=False):
    c = dict(context.items())
    services = sharing.get_services()

    c.update({
        'condensed': condensed,
        'services': services,
        'obj': obj,
    })
    return c
Exemplo n.º 3
0
def sharing_box(context):
    request = context['request']

    services = sharing.get_services()

    c = dict(context.items())
    c.update({
        'request': request,
        'user': request.user,
        'services': services
    })
    return c
Exemplo n.º 4
0
def test_get_services_in_ja_locale():

    testo = sharing.LOCALSERVICE1
    testo.shortname = 'translated-localservice1'

    expected = [
        'digg', 'facebook', 'delicious', 'myspace', 'friendfeed', 'twitter',
        'translated-localservice1'
    ]

    with patch.object(sharing, 'LOCALSERVICE1', testo):
        tower.activate('ja')
        assert expected == [s.shortname for s in sharing.get_services()]
Exemplo n.º 5
0
def test_get_services_in_ja_locale():

    testo = sharing.LOCALSERVICE1
    testo.shortname = 'translated-localservice1'

    expected = [
        'digg',
        'facebook',
        'delicious',
        'myspace',
        'friendfeed',
        'twitter',
        'translated-localservice1']

    with patch.object(sharing, 'LOCALSERVICE1', testo):
        tower.activate('ja')
        assert expected == [s.shortname for s in sharing.get_services()]
Exemplo n.º 6
0
def test_get_services_in_ja_locale():

    testo = sharing.LOCALSERVICE1
    testo.shortname = 'translated-localservice1'

    expected = [
        'facebook', 'twitter', 'gplus', 'Reddit', 'Tumblr',
        'translated-localservice1'
    ]

    with patch.object(sharing, 'LOCALSERVICE1', testo):
        old_locale = translation.get_language()
        try:
            tower.activate('ja')
            assert expected == [s.shortname for s in sharing.get_services()]
        finally:
            tower.activate(old_locale)
Exemplo n.º 7
0
def sharing_widget(context, obj, condensed=False):
    c = dict(context.items())

    services = sharing.get_services()

    counts = {}
    for service in services:
        short = encoding.smart_str(service.shortname)
        counts[short] = service.count_term(obj.share_counts[short])

    c.update({
        'condensed': condensed,
        'base_url': obj.share_url(),
        'counts': counts,
        'services': services,
        'obj': obj,
    })
    return c
Exemplo n.º 8
0
def sharing_widget(context, obj, condensed=False):
    c = dict(context.items())

    services = sharing.get_services()

    counts = {}
    for service in services:
        short = encoding.smart_str(service.shortname)
        counts[short] = service.count_term(obj.share_counts[short])

    c.update({
        'condensed': condensed,
        'base_url': obj.share_url(),
        'counts': counts,
        'services': services,
        'obj': obj,
    })
    return c
Exemplo n.º 9
0
def test_get_services_in_ja_locale():

    testo = sharing.LOCALSERVICE1
    testo.shortname = 'translated-localservice1'

    expected = [
        'facebook',
        'twitter',
        'gplus',
        'Reddit',
        'Tumblr',
        'translated-localservice1']

    with patch.object(sharing, 'LOCALSERVICE1', testo):
        old_locale = translation.get_language()
        try:
            tower.activate('ja')
            assert expected == [s.shortname for s in sharing.get_services()]
        finally:
            tower.activate(old_locale)
Exemplo n.º 10
0
def test_get_services_in_en_locale():
    # The order is the same as the order of sharing.SERVICES_LIST
    l = ['digg', 'facebook', 'delicious', 'myspace', 'friendfeed', 'twitter']
    assert l == [s.shortname for s in sharing.get_services()]
Exemplo n.º 11
0
def test_get_services_in_en_locale():
    # The order is the same as the order of sharing.SERVICES_LIST
    l = ['digg', 'facebook', 'delicious', 'myspace', 'friendfeed', 'twitter']
    assert l == [s.shortname for s in sharing.get_services()]
Exemplo n.º 12
0
def test_get_services_in_en_locale():
    # The order is the same as the order of sharing.SERVICES_LIST
    l = ['facebook', 'twitter', 'gplus', 'Reddit', 'Tumblr']
    assert l == [s.shortname for s in sharing.get_services()]
Exemplo n.º 13
0
def test_get_services_in_en_locale():
    # The order is the same as the order of sharing.SERVICES_LIST
    l = ['facebook', 'twitter', 'gplus', 'Reddit', 'Tumblr']
    assert l == [s.shortname for s in sharing.get_services()]