@register.simple_tag(takes_context=True)
def avatar_urls(context, user, size, service_id=None):
 service = avatar_services.for_user(user, service_id)
 if (service is None):
  logging.error(u'Could not get a suitable avatar service for user %s.', user)
  urls = {}
 else:
  urls = {resolution: url for (resolution, url) in six.iteritems(service.get_avatar_urls(request=context[u'request'], user=user, size=size))}
 return mark_safe(json.dumps(urls))

@ register . simple_tag ( takes_context = True ) def avatar_urls ( context , user , size , service_id = None ) : service = avatar_services . for_user ( user , service_id ) if ( service is None ) : logging . error ( u'Could not get a suitable avatar service for user %s.' , user ) urls = { } else : urls = { resolution : url for ( resolution , url ) in six . iteritems ( service . get_avatar_urls ( request = context [ u'request' ] , user = user , size = size ) ) } return mark_safe ( json . dumps ( urls ) )
serialize the users avatar urls into a javascript object .