def print_roles(self): query = UserRole.query(ancestor=get_key_roles()).order(-UserRole.date) query = query.filter(UserRole.show == True) roles = query.fetch() for role in roles: self.response.write("<option value='"+role.key.urlsafe()+"'>"+role.name+"</option>") self.response.write("</select>")
def post(self): query = UserRole.query().order(-UserRole.wins) roles = query.fetch(10) ranklist="" for role in roles: ranklist += "<li style='text-align:left;'>"+role.name+": "+str(role.wins)+"</li>" self.response.write(ranklist)
class GotoF(webapp2.RequestHandler): def get(self): user = users.get_current_user() if user: keystring = self.request.get('open') role = ndb.Key(urlsafe=keystring).get() self.response.headers['Content-Type']="text/html" self.response.write(HEADER) self.response.write(role.name+"'") self.response.write(MID) self.response.write(role.role+"'") self.response.write(N) self.response.write("<tr><td id='p1hp'>"+str(role.hp)+"</td><td id='p1atk'>"+str(role.atk)+"</td><td id='p1spd'>"+str(role.speed)+"</td><td id='p1def'>"+str(role.defence)+"</td><td id='p1lck'>"+str(role.luck)+"</td><td id = 'w'>"+str(role.wins)) self.response.write("""</td></tr> </table> """) self.response.write("<input type='hidden' style='z-index:99999;' name='key' id = 'key' value='"+ role.key.urlsafe()+"'></input>") self.response.write(END1) query = UserRole.query().order(-UserRole.wins) roles = query.fetch(10) ranklist="" for role in roles: ranklist += "<li style='text-align:left;'>"+role.name+": "+str(role.wins)+"</li>" self.response.write(ranklist)
def print_roles(self): query = UserRole.query(ancestor=get_key_roles()).order(-UserRole.date) query = query.filter(UserRole.show == True) roles = query.fetch() for role in roles: self.response.write("<option value='" + role.key.urlsafe() + "'>" + role.name + "</option>") self.response.write("</select>")
def post(self): query = UserRole.query().order(-UserRole.wins) roles = query.fetch(10) ranklist = "" for role in roles: ranklist += "<li style='text-align:left;'>" + role.name + ": " + str( role.wins) + "</li>" self.response.write(ranklist)
def post(self): user = users.get_current_user() if user: num = int(self.request.get('RoomNo')) query = Battle.query(ancestor=get_battle()) query = query.filter(Battle.roomNo == num) rooms = query.fetch() if len(rooms) == 0: self.response.out.write("Error1") elif len(rooms) > 1: self.response.out.write("Error2") else: room = rooms[0] attr1 = room.tempAtt1 attr2 = room.tempAtt2 if room.user1==users.get_current_user().nickname(): p=1 elif room.user2==users.get_current_user().nickname(): p=2 else: p=0 #error query = UserRole.query().order(-UserRole.wins) roles = query.fetch(10) ranklist=[] for role in roles: ranklist.append (role.name+": "+str(role.wins)) token = channel.create_channel(users.get_current_user().nickname() + str(num)) template_values = { "attr1": attr1, "attr2": attr2, "player": p, "token":token, "roomNum":room.roomNo, "ranklist":ranklist } # reading and rendering the template render_template(self, template_values) else: self.redirect('/nosign')
def post(self): user = users.get_current_user() if user: num = int(self.request.get('RoomNo')) query = Battle.query(ancestor=get_battle()) query = query.filter(Battle.roomNo == num) rooms = query.fetch() if len(rooms) == 0: self.response.out.write("Error1") elif len(rooms) > 1: self.response.out.write("Error2") else: room = rooms[0] attr1 = room.tempAtt1 attr2 = room.tempAtt2 if room.user1 == users.get_current_user().nickname(): p = 1 elif room.user2 == users.get_current_user().nickname(): p = 2 else: p = 0 #error query = UserRole.query().order(-UserRole.wins) roles = query.fetch(10) ranklist = [] for role in roles: ranklist.append(role.name + ": " + str(role.wins)) token = channel.create_channel( users.get_current_user().nickname() + str(num)) template_values = { "attr1": attr1, "attr2": attr2, "player": p, "token": token, "roomNum": room.roomNo, "ranklist": ranklist } # reading and rendering the template render_template(self, template_values) else: self.redirect('/nosign')