当前位置: 首页>>代码示例>>Python>>正文


Python base.Session类代码示例

本文整理汇总了Python中springgrid.lib.base.Session的典型用法代码示例。如果您正苦于以下问题:Python Session类的具体用法?Python Session怎么用?Python Session使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Session类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setbotrunnernotsupportsthisai

def setbotrunnernotsupportsthisai(botrunnername, ainame, aiversion):
    botrunner = botrunnerhelper.getBotRunner( botrunnername )
    for ai in botrunner.supportedais:
        if ai.ai_base.ai_base_name == ainame and ai.ai_version == aiversion:
            botrunner.supportedais.remove( ai )
    Session.commit()
    return (True,'')
开发者ID:gajop,项目名称:springgrid,代码行数:7,代码来源:aihelper.py

示例2: storeresult

def storeresult( botrunnername, matchrequest_id, result ):
    # delete any existing result, saves doing check first...
    matchrequest = getmatchrequest( matchrequest_id )
    if matchrequest == None:
        return
    matchrequest.matchresult  = MatchResult( result )
    Session.commit()
开发者ID:gajop,项目名称:springgrid,代码行数:7,代码来源:matchrequestcontroller.py

示例3: setbotrunnersupportsthismap

def setbotrunnersupportsthismap(botrunnername, mapname):
    # Now, register the map as supported map
    botrunner = botrunnerhelper.getBotRunner(botrunnername)
    for map in botrunner.supportedmaps:
        if map.map_name == mapname:
            return (True, "")
    map = getMap(mapname)
    botrunner.supportedmaps.append(map)
    Session.commit()
    return (True, "")
开发者ID:gajop,项目名称:springgrid,代码行数:10,代码来源:maphelper.py

示例4: add

    def add(self):
        botrunnerName = self.form_result["botrunnerName"]
        sharedSecret = self.form_result["sharedSecret"]

        botrunner = BotRunner(botrunnerName, sharedSecret)
        Session.add(botrunner)
        Session.commit()

        c.message = "Added ok"
        return render('genericmessage.html')
开发者ID:gajop,项目名称:springgrid,代码行数:10,代码来源:botrunner.py

示例5: addLeagueMatches

def addLeagueMatches(league, matchRequestQueue, matchResults):
    ais = Session.query(AI).join(LeagueAI).filter(LeagueAI.league_id ==\
                league.league_id).all()
                
    map = Session.query(Map).filter(Map.map_id == league.map_id).first()
    mod = Session.query(Mod).filter(Mod.mod_id == league.mod_id).first()
               
    playAgainstSelf = league.play_against_self
    if league.side_modes == "xvsy":
        sides = [int(i) for i in league.sides.split("vs")]
    else:
        sides = [int(league.sides)]
    
    matchRequests = []    
    for i, ai0 in enumerate(ais[:-1]):
        for j, ai1 in enumerate(ais[i:]):
            if not playAgainstSelf and ai0.ai_id == ai1.ai_id:
                continue
            first = Session.query(ModSide).filter(ModSide.mod_side_id == sides[0]).first()
            if len(sides) == 2:
                second = Session.query(ModSide).filter(ModSide.mod_side_id == sides[1]).first()
                allSides = [(first, second), (second, first)]
            else:
                allSides = [(first, first)]
            for firstSide, secondSide in allSides:
                for k in xrange(league.matches_per_ai_pair):
                    matchRequest = MatchRequest(ai0, ai1, map, mod,\
                        league.speed, league.soft_timeout, league.hard_timeout,\
                        firstSide, secondSide, league.league_id)
                    matchRequests.append(matchRequest)                        
    #save all matches to the database
    Session.add_all(matchRequests)
    Session.commit()
开发者ID:gajop,项目名称:springgrid,代码行数:33,代码来源:matchscheduler.py

示例6: addstaticdata

def addstaticdata():
    rolerows = Session.query(Role).all()
    for rolename in [ 'accountadmin', 'aiadmin', 'mapadmin', 'modadmin', 'leagueadmin', 'botrunneradmin', 'requestadmin', 'apiclient' ]:
        rolefound = False
        for rolerow in rolerows:
            if rolerow.role_name == rolename:
                rolefound = True
        if not rolefound:
            role = Role(rolename)
            Session.add(role)
            Session.flush()
开发者ID:gajop,项目名称:springgrid,代码行数:11,代码来源:roles.py

示例7: setValue

def setValue(key_name, key_value):
    global defaults

    if not defaults.has_key(key_name):
        raise Exception("confighelper.setvalue, no such key_name: " + key_name)

    configrow = Session.query(Config).filter(Config.config_key == key_name).first()
    if configrow == None:
        config = Config(key_name, key_value)
        Session.add(config)
    else:
        configrow.setValue(key_value)
开发者ID:gajop,项目名称:springgrid,代码行数:12,代码来源:confighelper.py

示例8: view

    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')
开发者ID:gajop,项目名称:springgrid,代码行数:13,代码来源:account.py

示例9: logonUserWithAuthenticatedOpenID

def logonUserWithAuthenticatedOpenID(openidurl):
    account = None
    # note: this could be optimized a little...
    for thisaccount in Session.query(Account):
        for openid in thisaccount.openids:
            if openid.openid == openidurl:
                account = thisaccount
    if account == None:
        # create new account
        account = Account(openidurl, openidurl)
        account.openids.append(OpenID(openidurl))
        Session.add(account)

    session['username'] = openidurl
开发者ID:gajop,项目名称:springgrid,代码行数:14,代码来源:loginhelper.py

示例10: remove

    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')
开发者ID:gajop,项目名称:springgrid,代码行数:15,代码来源:engine.py

示例11: remove

    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")
开发者ID:gajop,项目名称:springgrid,代码行数:15,代码来源:ai.py

示例12: remove

    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')
开发者ID:gajop,项目名称:springgrid,代码行数:15,代码来源:map.py

示例13: remove

    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")
开发者ID:gajop,项目名称:springgrid,代码行数:15,代码来源:mod.py

示例14: list

    def list(self):
        maps = Session.query(Map)
        showForm = roles.isInRole(roles.mapadmin)

        c.showForm = showForm
        c.maps = maps
        return render('viewmaps.html')
开发者ID:gajop,项目名称:springgrid,代码行数:7,代码来源:map.py

示例15: list

    def list(self):
        mods = Session.query(Mod)
        showForm = roles.isInRole(roles.modadmin)

        c.showForm = showForm
        c.mods = mods
        return render("viewmods.html")
开发者ID:gajop,项目名称:springgrid,代码行数:7,代码来源:mod.py


注:本文中的springgrid.lib.base.Session类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。