def list(self): maps = Session.query(Map) showForm = roles.isInRole(roles.mapadmin) c.showForm = showForm c.maps = maps return render('viewmaps.html')
def list(self): engines = Session.query(Engine) showForm = roles.isInRole(roles.modadmin) c.showForm = showForm c.engines = engines return render('viewengines.html')
def list(self): mods = Session.query(Mod) showForm = roles.isInRole(roles.modadmin) c.showForm = showForm c.mods = mods return render("viewmods.html")
def list(self): ais = Session.query(AI) showForm = roles.isInRole(roles.aiadmin) c.ais = ais c.showForm = showForm return render("viewais.html")
def list(self): leagues = Session.query(League) showForm = roles.isInRole(roles.leagueadmin) mods = Session.query(Mod) ais = Session.query(AI) tmpais = {} maps = Session.query(Map) c.maps = {} for map in maps: c.maps[map.map_id] = map.map_name mods = Session.query(Mod) c.mods = {} for mod in mods: c.mods[mod.mod_id] = mod.mod_name modsides = {} for i, mod in enumerate(mods): sides = Session.query(ModSide).filter(ModSide.mod_id == mod.mod_id) modsides[mod.mod_name] = (i, []) for side in sides: modsides[mod.mod_name][1].append((side.mod_side_name, side.mod_side_id)) for ai in ais: tmpais[ai.ai_id] = ai.ai_base.ai_base_name + " " + ai.ai_version c.ais = tmpais c.sides = modsides c.showForm = showForm c.leagues = leagues c.sidemodes = { "allsame" : "All same", "xvsy" : "X vs Y" } c.speeds = [20] #default c.speeds.extend(range(1, 10)) c.speeds.extend(range(10, 101, 5)) c.timeouts = c.speeds return render('viewleagues.html')
def list(self): #if loginhelper.gusername == '': # jinjahelper.message( "Please login first before using this page.") # return c.accounts = Session.query(Account) c.roles = roles showform = roles.isInRole(roles.accountadmin) return render('viewaccounts.html')
def view(self, id): map = Session.query(Map).filter(Map.map_id == id).first() if map == None: c.message = "No such map" return render('genericmessage.html') showform = roles.isInRole(roles.mapadmin) c.map = map c.showForm = showform return render('viewmap.html')
def view(self, id): mod = Session.query(Mod).filter(Mod.mod_id == id).first() if mod == None: c.message = "No such mod" return render("genericmessage.html") showForm = roles.isInRole(roles.modadmin) c.showForm = showForm c.mod = mod return render("viewmod.html")
def view(self, id): engine = Session.query(Engine).filter(Engine.engine_id == id).first() if engine == None: c.message = "No such engine" return render('genericmessage.html') showForm = roles.isInRole(roles.modadmin) c.showForm = showForm c.engine = engine return render('viewengine.html')
def view(self, id): botrunner = Session.query(BotRunner).filter( BotRunner.botrunner_id == id).first() c.isbotrunnerowner = ('user' in session and botrunner.owneraccount != None and botrunner.owneraccount.username == session['user']) c.showform = (c.isbotrunnerowner or roles.isInRole(roles.botrunneradmin)) c.botrunner = botrunner return render('viewbotrunner.html')
def view(self, id): ai = Session.query(AIBase).filter(AIBase.ai_base_id == id).first() if ai == None: c.message = "No such ai" return render("genericmessage.html") showform = roles.isInRole(roles.aiadmin) c.ai = ai c.showForm = showform return render("viewai.html")
def view(self, id): account = Session.query(Account).filter( Account.account_id == id).first() showform = roles.isInRole(roles.accountadmin) potentialroles = [i[0] for i in Session.query(Role.role_name)] for role in account.roles: potentialroles.remove(role.role_name) c.account = account c.showForm = showform return render('viewaccount.html')
def remove(self, id): if not roles.isInRole(roles.modadmin): c.message = "You must be logged in as a modadmin" return render("genericmessage.html") mod = Session.query(Mod).filter(Mod.mod_id == id).first() if mod == None: c.message = "No such mod" return render("genericmessage.html") Session.delete(mod) Session.commit() c.message = "Deleted ok" return render("genericmessage.html")
def remove(self, id): if not roles.isInRole(roles.modadmin): c.message = "You must be logged in as a modadmin, temporary!" return render('genericmessage.html') engine = Session.query(Engine).filter(Engine.engine_id == id).first() if engine == None: c.message = "No such engine" return render('genericmessage.html') Session.delete(engine) Session.commit() c.message = "Deleted ok" return render('genericmessage.html')
def remove(self, id): if not roles.isInRole(roles.mapadmin): c.message = "You must be logged in as a mapadmin" return render('genericmessage.html') map = Session.query(Map).filter(Map.map_id == id).first() if map == None: c.message = "No such map" return render('genericmessage.html') Session.delete(map) Session.commit() c.message = "Deleted ok" return render('genericmessage.html')
def remove(self, id): if not roles.isInRole(roles.aiadmin): c.message = "You must be logged in as a aiadmin" return render("genericmessage.html") ai = Session.query(AI).filter(AI.ai_id == id).first() if ai == None: c.message = "No such ai" return render("genericmessage.html") Session.delete(ai) Session.commit() c.message = "Deleted ok" return render("genericmessage.html")
def remove(self, id): if not roles.isInRole(roles.leagueadmin): c.message = "You must be logged in as a leagueadmin" return render('genericmessage.html') league = Session.query(League).filter(League.league_id == id).first() if league == None: c.message = "No such league" return render('genericmessage.html') Session.query(LeagueAI).filter(LeagueAI.league_id == id).delete() Session.delete(league) Session.commit() c.message = "Deleted ok" return render('genericmessage.html')
def remove(self, id): if not roles.isInRole(roles.leagueadmin): c.message = "You must be logged in as a leagueadmin" return render('genericmessage.html') request = Session.query(MatchRequest).filter(MatchRequest.matchrequest_id == id).first() if request == None: c.message = "No such request" return render('genericmessage.html') Session.delete(request) Session.commit() c.message = "Deleted ok" return render('genericmessage.html')
def add(self): if not roles.isInRole(roles.mapadmin): c.message = "You must be logged in as a mapadmin" return render('genericmessage.html') mapname = self.form_result["mapName"] maparchivechecksum = self.form_result["mapArchiveChecksum"] mapurl = self.form_result["mapUrl"] map = Map(mapname) map.map_url = mapurl map.map_archivechecksum = maparchivechecksum Session.add(map) Session.commit() c.message = "Added ok" return render('genericmessage.html')
def add(self): if not roles.isInRole(roles.modadmin): c.message = "You must be logged in as a modadmin. Sorry, temporary" return render('genericmessage.html') enginename = self.form_result["engineName"] enginearchivechecksum = self.form_result["engineArchiveChecksum"] engineurl = self.form_result["engineUrl"] engine = Engine(enginename) engine.engine_url = engineurl engine.engine_archivechecksum = enginearchivechecksum Session.add(engine) Session.commit() c.message = "Added ok" return render('genericmessage.html')
def add(self): if not roles.isInRole(roles.modadmin): c.message = "You must be logged in as a modadmin" return render("genericmessage.html") modname = self.form_result["modName"] modarchivechecksum = self.form_result["modArchiveChecksum"] modurl = self.form_result["modUrl"] mod = Mod(modname) mod.mod_url = modurl mod.mod_archivechecksum = modarchivechecksum Session.add(mod) Session.commit() c.message = "Added ok" return render("genericmessage.html")
def add(self): if not roles.isInRole(roles.accountadmin): c.message = "You must be logged in as a accountadmin" return render('genericmessage.html') username = self.form_result['username'] userfullname = self.form_result['userfullname'] email = self.form_result['email'] password = self.form_result['password'] account = Account(username, userfullname) account.passwordinfo = PasswordInfo(password) account.email = email Session.add(account) Session.commit() c.message = "Added ok" return render('genericmessage.html')
def add(self): if not roles.isInRole(roles.aiadmin): c.message = "You must be logged in as aiadmin" return render("genericmessage.html") aiName = self.form_result["aiName"] aiVersion = self.form_result["aiVersion"] downloadUrl = self.form_result["downloadUrl"] needsCompiling = self.form_result["needsCompiling"] ai = AI(aiName, aiVersion) ai.ai_downloadurl = downloadUrl ai.ai_needscompiling = needsCompiling ai.owneraccount = accounthelper.getAccount(session["user"]) Session.add(ai) Session.commit() c.message = "Added ok" return render("genericmessage.html")
def update(self, id): if not roles.isInRole(roles.mapadmin): c.message = "You must be logged in as a mapadmin" return render('genericmessage.html') mapName = self.form_result['mapName'] mapArchiveChecksum = self.form_result["mapArchiveChecksum"] mapUrl = self.form_result["mapUrl"] map = Session.query(Map).filter(Map.map_id == id).first() if map == None: c.message = "No such map" return render('genericmessage.html') map.map_name = mapName map.map_url = mapUrl map.map_archivechecksum = mapArchiveChecksum Session.commit() c.message = "Updated ok" return render('genericmessage.html')
def update(self, id): if not roles.isInRole(roles.modadmin): c.message = "You must be logged in as a modadmin" return render('genericmessage.html') engineName = self.form_result['engineName'] engineArchiveChecksum = self.form_result["engineArchiveChecksum"] engineUrl = self.form_result["engineUrl"] engine = Session.query(Engine).filter(Engine.engine_id == id).first() if engine == None: c.message = "No such engine" return render('genericmessage.html') engine.engine_name = engineName engine.engine_url = engineUrl engine.engine_archivechecksum = engineArchiveChecksum Session.commit() c.message = "Updated ok" return render('genericmessage.html')
def update(self, id): if not roles.isInRole(roles.modadmin): c.message = "You must be logged in as a modadmin" return render("genericmessage.html") modName = self.form_result["modName"] modArchiveChecksum = self.form_result["modArchiveChecksum"] modUrl = self.form_result["modUrl"] mod = Session.query(Mod).filter(Mod.mod_id == id).first() if mod == None: c.message = "No such mod" return render("genericmessage.html") mod.mod_name = modName mod.mod_url = modUrl mod.mod_archivechecksum = modArchiveChecksum Session.commit() c.message = "Updated ok" return render("genericmessage.html")
def update(self, id): if not roles.isInRole(roles.leagueadmin): c.message = "You must be logged in as a leagueadmin" return render('genericmessage.html') leagueName = self.form_result['leagueName'] leagueArchiveChecksum = self.form_result["leagueArchiveChecksum"] leagueUrl = self.form_result["leagueUrl"] league = Session.query(League).filter(League.league_id == id).first() if league == None: c.message = "No such league" return render('genericmessage.html') league.league_name = leagueName league.league_url = leagueUrl league.league_archivechecksum = leagueArchiveChecksum Session.commit() c.message = "Updated ok" return render('genericmessage.html')
def update(self, id): if not roles.isInRole(roles.accountadmin): c.message = "You must be logged in as a accountadmin" return render('genericmessage.html') accountName = self.form_result['accountName'] accountArchiveChecksum = self.form_result["accountArchiveChecksum"] accountUrl = self.form_result["accountUrl"] account = Session.query(Account).filter( Account.account_id == id).first() if account == None: c.message = "No such account" return render('genericmessage.html') account.account_name = accountName account.account_url = accountUrl account.account_archivechecksum = accountArchiveChecksum Session.commit() c.message = "Updated ok" return render('genericmessage.html')
def add(self): if not roles.isInRole(roles.leagueadmin): c.message = "You must be logged in as a leagueadmin" return render('genericmessage.html') leagueName = self.form_result["leagueName"] modId = self.form_result["modId"] mapId = self.form_result["mapId"] speed = self.form_result["speed"] softtimeout = self.form_result["softtimeout"] hardtimeout = self.form_result["hardtimeout"] nummatchesperaipair = self.form_result["nummatchesperaipair"] sides = self.form_result["sides"] sidemodes = self.form_result["sidemodes"] playagainstself = self.form_result["playagainstself"] account = Session.query(Account).filter(Account.username == session['user']).first() ais = [] for i in range(Session.query(AI).count()): ai_i = 'ai_checkbox_' + str(i) if (self.form_result.has_key(ai_i)): ais.append(i) league = League(leagueName, account, modId, mapId, nummatchesperaipair, speed, softtimeout, hardtimeout, sides, sidemodes, playagainstself) leagueais = [LeagueAI(ai, league) for ai in ais] Session.add(league) Session.add_all(leagueais) matchrequests = Session.query(MatchRequest).filter(MatchRequest.league_id ==\ league.league_id) matchresults = [req for req in matchrequests if req.matchresult != None] matchscheduler.addLeagueMatches(league, matchrequests, matchresults) Session.flush() Session.commit() redirect(url(controller='league', action='view', id=league.league_id))
def update(self, id): if not roles.isInRole(roles.aiadmin): c.message = "You must be logged in as a aiadmin" return render("genericmessage.html") aiName = self.form_result["aiName"] aiVersion = self.form_result["aiVersion"] downloadUrl = self.form_result["downloadUrl"] needsCompiling = self.form_result["needsCompiling"] ai = Session.query(AI).filter(AI.ai_id == id).first() if ai == None: c.message = "No such ai" return render("genericmessage.html") ai.ai_name = aiName ai.ai_version = aiVersion ai.ai_downloadurl = downloadUrl ai.ai_needscompiling = needsCompiling Session.commit() c.message = "Updated ok" return render("genericmessage.html")