original_docstring: Return user Profile from datastore, creating new one if non-existent.
docstring: Return user Profile from datastore, creating new one if non-existent.
docstring_tokens: Return user Profile from datastore creating new one if non - existent .
code: 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
code_tokens: 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
short_docstring: Return user Profile from datastore, creating new one if non-existent.
short_docstring_tokens: Return user Profile from datastore creating new one if non - existent .
comment: """Return user Profile from datastore, creating new one if non-existent."""$SEP$# make sure user is authed
  $SEP$# get Profile from datastore
  $SEP$# create new Profile if not there
  