def get(self, match_id, people_id): match = Match.getone(match_id) if match is None: raise MatchNotExistsError people = People.getone(people_id) if people.key in match.registerdPeople: return {"in": True} else: return {"in": False}
def signup(cls, match_id, code): match = Match.getone(match_id) people = People.getone(current_user.key_id) if people and people.key in match.registerdPeople: logging.debug("You have already signed up") return True if match and code == match.signupCode: logging.debug("Sign up user {}".format(current_user.key_id)) match.signup(current_user.key_id) Play.create(current_user.key_id, match_id) memcache.flush_all() return True return False
def askforleave(cls, match_id, status): match = Match.getone(match_id) people = People.getone(current_user.key_id) if people and people.key in match.registerdPeople: logging.debug("You have already signed up! Now switch leave") play = Play.getbyMatchPeople(match_id, current_user.key_id) if play: play.leave = status play.put() elif people and people.key: match.signup(current_user.key_id) Play.create(current_user.key_id, match_id, leave=status) memcache.flush_all() return True
def post(self): args = update_parser.parse_args() name = args.get('name') password = args.get('password') position = args.get('position') logging.debug("update name {} and password {}".format(name.encode('utf-8'), password)) if name: me = People.getone(current_user.key_id) me.name = name me.position = position if password != 'itissecret': me.genpass(password) me.put() return {"status": True}
def post(self): args = update_parser.parse_args() name = args.get('name') password = args.get('password') position = args.get('position') logging.debug("update name {} and password {}".format( name.encode('utf-8'), password)) if name: me = People.getone(current_user.key_id) me.name = name me.position = position if password != 'itissecret': me.genpass(password) me.put() return {"status": True}
def signin(cls, match_id, code): match = Match.getone(match_id) if datetime.now() < match.signinEarliest: logging.debug("You are too early for sign in") return {"status": False, "reason": "You are too early for sign in", "code": -1} if datetime.now() > match.signinLatest: logging.debug("You are too late for sign in") logging.debug("Sign in user {}".format(current_user.key_id)) match.signin(current_user.key_id) play = Play.getbyMatchPeople(match_id, current_user.key_id) if play is None: logging.debug("this guy didn't sign up, but is sign-in now") match.signup(current_user.key_id) Play.create(current_user.key_id, match_id, missing=True) else: play.signinTime = datetime.now() play.put() memcache.flush_all() return {"status": False, "reason": "You are too late for sign in", "code": 1} people = People.getone(current_user.key_id) if people and people.key in match.participatedPeople: logging.debug("You have already signed in") return {"status": False, "reason": "You have already signed in", "code": 0} if match and code == match.signinCode: logging.debug("Sign in user {}".format(current_user.key_id)) match.signin(current_user.key_id) play = Play.getbyMatchPeople(match_id, current_user.key_id) if play is None: logging.debug("this guy didn't sign up, but is sign-in now") match.signup(current_user.key_id) Play.create(current_user.key_id, match_id, missing=True) else: play.signinTime = datetime.now() play.put() memcache.flush_all() return {"status": True} return {"status": False}
def get(self): me = People.getone(current_user.key_id) me.password = '******' return me
def get(self, people_id): people = People.getone(people_id) people.__setattr__('id', people_id) return {"people": people}