(user=None)
return template.replace('{% key %}', data[0]) \
                    .replace('{% token %}', data[1]) \
                    .replace('{% scope %}', ' '.join(data[2]))
A simple tag that stores verification data for Google
A simple tag that stores verification data for Google
A simple tag that stores verification data for Google
def google_data(user=None):
    """ A simple tag that stores verification data for Google """
    if user is None or user.is_anonymous(): return ''
    template = """<script>
        window.GOOGLE_DATA = {
            access_token: "{% token %}",
            client_id: "{% key %}",
            plus_scope: "{% scope %}",
            plus_id: "{% key %}"
        };
    </script>"""
    try:
        us = UserSocialAuth.objects.get(user=user, provider='google-plus')
        data = (
            settings.SOCIAL_AUTH_GOOGLE_PLUS_KEY,
            us.extra_data['access_token'],
            settings.SOCIAL_AUTH_GOOGLE_PLUS_SCOPE,
        )
    except UserSocialAuth.DoesNotExist:
        data = ('','','')
    return template.replace('{% key %}', data[0]) \
                    .replace('{% token %}', data[1]) \
                    .replace('{% scope %}', ' '.join(data[2]))
def google_data ( user = None ) : if user is None or user . is_anonymous ( ) : return '' template = """<script>
        window.GOOGLE_DATA = {
            access_token: "{% token %}",
            client_id: "{% key %}",
            plus_scope: "{% scope %}",
            plus_id: "{% key %}"
        };
    </script>""" try : us = UserSocialAuth . objects . get ( user = user , provider = 'google-plus' ) data = ( settings . SOCIAL_AUTH_GOOGLE_PLUS_KEY , us . extra_data [ 'access_token' ] , settings . SOCIAL_AUTH_GOOGLE_PLUS_SCOPE , ) except UserSocialAuth . DoesNotExist : data = ( '' , '' , '' ) return template . replace ( '{% key %}' , data [ 0 ] ) . replace ( '{% token %}' , data [ 1 ] ) . replace ( '{% scope %}' , ' ' . join ( data [ 2 ] ) )