def doUserPoint(uname, do, point): user = UserPoint.get_by_key_name("u" + uname) if not user: user = UserPoint(key_name="u" + uname) if do == "+": user.point += point else: user.point -= point user.put()
def getorAddUserPoint(uname): user = UserPoint.get_by_key_name("u" + uname) if not user: user = UserPoint(key_name="u" + uname) user.put() return user