conference.py
def _getProfileFromUser(self):
        """Return user Profile from datastore,
        creating new one if non-existent."""
        # make sure user is authed
        user = endpoints.get_current_user()
        if not user:
            raise endpoints.UnauthorizedException(
                'Authorization required')

        # get Profile from datastore
        user_id = getUserId(user)
        p_key = ndb.Key(Profile, user_id)
        profile = p_key.get()
        # create new Profile if not there
        if not profile:
            profile = Profile(
                        key          = p_key,
                        displayName  = user.nickname(),
                        mainEmail    = user.email(),
                        teeShirtSize = str(TeeShirtSize.NOT_SPECIFIED),)
            profile.put()
        # return Profile
        return profile
Return user Profile from datastore,
        creating new one if non-existent.
Return user Profile from datastore,
creating new one if non-existent.
Return user Profile from datastore creating new one if non - existent .
def _getProfileFromUser(self):
        user = endpoints.get_current_user()
        if not user:
            raise endpoints.UnauthorizedException(
                'Authorization required')
        user_id = getUserId(user)
        p_key = ndb.Key(Profile, user_id)
        profile = p_key.get()
        if not profile:
            profile = Profile(
                        key          = p_key,
                        displayName  = user.nickname(),
                        mainEmail    = user.email(),
                        teeShirtSize = str(TeeShirtSize.NOT_SPECIFIED),)
            profile.put()
        return profile
def _getProfileFromUser ( self ) : user = endpoints . get_current_user ( ) if not user : raise endpoints . UnauthorizedException ( 'Authorization required' ) user_id = getUserId ( user ) p_key = ndb . Key ( Profile , user_id ) profile = p_key . get ( ) if not profile : profile = Profile ( key = p_key , displayName = user . nickname ( ) , mainEmail = user . email ( ) , teeShirtSize = str ( TeeShirtSize . NOT_SPECIFIED ) , ) profile . put ( ) return profile
Return user Profile from datastore,
creating new one if non-existent.
Return user Profile from datastore creating new one if non - existent .
"""Return user Profile from datastore,
        creating new one if non-existent.""" # make sure user is authed # get Profile from datastore # create new Profile if not there # return Profile
self