Write our users to Marketo as leads.

This commit is contained in:
Jake Moshenko 2016-10-13 13:48:35 -04:00
parent 013e27f7d5
commit f04b018805
11 changed files with 250 additions and 6 deletions

View file

@ -10,7 +10,7 @@ from peewee import IntegrityError
import features
from app import app, billing as stripe, authentication, avatar
from app import app, billing as stripe, authentication, avatar, user_analytics
from auth import scopes
from auth.auth_context import get_authenticated_user
from auth.permissions import (AdministerOrganizationPermission, CreateRepositoryPermission,
@ -119,6 +119,14 @@ def user_view(user):
'tag_expiration': user.removed_tag_expiration_s,
})
analytics_metadata = user_analytics.get_user_analytics_metadata(user)
# This is a sync call, but goes through the async wrapper interface and
# returns a Future. By calling with timeout 0 immediately after the method
# call, we ensure that if it ever accidentally becomes async it will raise
# a TimeoutError.
user_response.update(analytics_metadata.result(timeout=0))
user_view_perm = UserReadPermission(user.username)
if user_view_perm.can():
user_response.update({