def get(self): self.response.headers['Content-Type'] = 'application/json; charset=utf-8' title = self.request.get("title") # This won't work when we change our front-end, since it modifies the way that the html form submits dates/times eventDate = convertInputToDatetime(self.request.get("eventtime")) pointOfNoReturn = convertInputToDatetime(self.request.get("responsetime")) userKey = mpusers.userIdFromGoogleId(users.get_current_user().user_id()) # try to create the plan plan = createPlan(userKey, title, pointOfNoReturn, eventDate) if plan is not None: self.response.write(json.dumps(convertPlanToDictionary(plan))) OGuserid = mpusers.userIdFromGoogleId(users.get_current_user().user_id()) invites.createInvite(OGuserid, plan.planId) # The line directly below does not work and I can't figure out why # invites.respondToInvite(OGuserid, plan.planId, 'yes') invitedNums = self.request.get("invites").split() for num in invitedNums: userid = mpusers.getUserIdByNumber(num) if userid is None: userid = mpusers.createShadowUser(num).userId invites.createInvite(userid, plan.planId) else: self.response.write(title + " already exists")
def get(self): self.response.headers[ 'Content-Type'] = 'application/json; charset=utf-8' title = self.request.get("title") # This won't work when we change our front-end, since it modifies the way that the html form submits dates/times eventDate = convertInputToDatetime(self.request.get("eventtime")) pointOfNoReturn = convertInputToDatetime( self.request.get("responsetime")) userKey = mpusers.userIdFromGoogleId( users.get_current_user().user_id()) # try to create the plan plan = createPlan(userKey, title, pointOfNoReturn, eventDate) if plan is not None: self.response.write(json.dumps(convertPlanToDictionary(plan))) OGuserid = mpusers.userIdFromGoogleId( users.get_current_user().user_id()) invites.createInvite(OGuserid, plan.planId) # The line directly below does not work and I can't figure out why # invites.respondToInvite(OGuserid, plan.planId, 'yes') invitedNums = self.request.get("invites").split() for num in invitedNums: userid = mpusers.getUserIdByNumber(num) if userid is None: userid = mpusers.createShadowUser(num).userId invites.createInvite(userid, plan.planId) else: self.response.write(title + " already exists")
def addToGroup(groupid, phoneNums): noProblems = True for num in phoneNums: qq = GroupMember.all() qq.filter("groupId =", groupid) uId = mpusers.getUserIdByNumber(num) if uId is None: tempUser = mpusers.createShadowUser(num) uId = tempUser.userId qq.filter("userId =", uId) if qq.get() is None: gm = GroupMember(groupId=groupid, userId=uId) gm.put() else: noProblems = False return noProblems