def getConferencesCreated(self, user, request): """Return conferences created by user.""" user_id = getUserId(user) confs, prof = queries.get_user_conferences(user_id) items = [utils.copyConferenceToForm(conf, getattr(prof, 'displayName')) for conf in confs] return ConferenceForms(items=items)
def createConference(self, user, request): """Create new conference.""" user_id = getUserId(user) response, data = utils.createConferenceObject(user_id, request) queries.create_conference(user_id, data) taskqueue.add(params={'email': user.email(), 'conferenceInfo': repr(response)}, url='/tasks/send_confirmation_email') return response
def createSession(self, user, request): """Create Session.""" user_id = getUserId(user) wsck = request.websafeConferenceKey queries.get_user_conference(user_id, wsck) data = utils.getSessionData(request) session = queries.create_session(data, wsck) taskqueue.add(params={'speaker': session.speaker.name, "wsck": wsck}, url='/tasks/set_featured_speaker') return utils.copySessionToForm(session)
def get_create_profile(user): user_id = getUserId(user) p_key = ndb.Key(Profile, user_id) profile = p_key.get() # create new Profile if not there if not profile: size = str(models.TeeShirtSize.NOT_SPECIFIED) profile = Profile( key=p_key, displayName=user.nickname(), mainEmail=user.email(), teeShirtSize=size) profile.put() return profile