def add_contributor_json(user, current_user=None):
 if current_user:
  n_projects_in_common = current_user.n_projects_in_common(user)
 else:
  n_projects_in_common = 0
 current_employment = None
 education = None
 if user.jobs:
  current_employment = user.jobs[0]['institution']
 if user.schools:
  education = user.schools[0]['institution']
 return {'fullname': user.fullname, 'email': user.username, 'id': user._primary_key, 'employment': current_employment, 'education': education, 'n_projects_in_common': n_projects_in_common, 'registered': user.is_registered, 'active': user.is_active, 'gravatar_url': gravatar(user, use_ssl=True, size=settings.PROFILE_IMAGE_MEDIUM), 'profile_url': user.profile_url}

def add_contributor_json ( user , current_user = None ) : if current_user : n_projects_in_common = current_user . n_projects_in_common ( user ) else : n_projects_in_common = 0 current_employment = None education = None if user . jobs : current_employment = user . jobs [ 0 ] [ 'institution' ] if user . schools : education = user . schools [ 0 ] [ 'institution' ] return { 'fullname' : user . fullname , 'email' : user . username , 'id' : user . _primary_key , 'employment' : current_employment , 'education' : education , 'n_projects_in_common' : n_projects_in_common , 'registered' : user . is_registered , 'active' : user . is_active , 'gravatar_url' : gravatar ( user , use_ssl = True , size = settings . PROFILE_IMAGE_MEDIUM ) , 'profile_url' : user . profile_url }
generate a dictionary representation of a user .