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


Python DBSession.merge方法代码示例

本文整理汇总了Python中pynformatics.models.DBSession.merge方法的典型用法代码示例。如果您正苦于以下问题:Python DBSession.merge方法的具体用法?Python DBSession.merge怎么用?Python DBSession.merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pynformatics.models.DBSession的用法示例。


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

示例1: problem_generate_samples

# 需要导入模块: from pynformatics.models import DBSession [as 别名]
# 或者: from pynformatics.models.DBSession import merge [as 别名]
def problem_generate_samples(request):
    try:
        checkCapability(request)
        problem = DBSession.query(EjudgeProblem).filter(EjudgeProblem.id == request.matchdict['problem_id']).first()
        problem.generateSamples()
#        res = ""
#        if problem.sample_tests != '':
#            res = "<div class='problem-statement'><div class='sample-tests'><div class='section-title'>Примеры</div>"
#        
#            for i in problem.sample_tests.split(","):
#                res += "<div class='sample-test'>"
#                res += "<div class='input'><div class='title'>Входные данные</div><pre class='content'>"
#                res += get_test(problem, i)
#                res += "</pre></div><div class='output'><div class='title'>Выходные данные</div><pre class='content'>"
#                res += get_corr(problem, i)
#                res += "</pre></div></div>"
#        
#            res += "</div></div>"
#
#        problem.sample_tests_html = res
        with transaction.manager:
           DBSession.merge(problem)
        return {"result" : "ok", "content" : problem.sample_tests}
    except Exception as e:
        return {"result" : "error", "content" : e.__str__(), "stack" : traceback.format_exc()}
开发者ID:bdolgov,项目名称:ej-ants,代码行数:27,代码来源:problem.py

示例2: setShowLimits

# 需要导入模块: from pynformatics.models import DBSession [as 别名]
# 或者: from pynformatics.models.DBSession import merge [as 别名]
def setShowLimits(problem_id, show_limits):
    problem = DBSession.query(Problem).filter(Problem.id == problem_id).first()

    problem.show_limits = show_limits
    with transaction.manager:
        DBSession.merge(problem)
    return "Ok"
开发者ID:bdolgov,项目名称:ej-ants,代码行数:9,代码来源:problem.py

示例3: approve

# 需要导入模块: from pynformatics.models import DBSession [as 别名]
# 或者: from pynformatics.models.DBSession import merge [as 别名]
def approve(request):
    try:
        id = int(html.escape(request.params['id'])) 
        ideal = DBSession.query(Ideal).filter_by(id=id).first()
        ideal.status = html.escape(request.params['status']) 
        with transaction.manager:
            DBSession.merge(ideal)
        return HTTPFound(location="/mod/statements/view3.php?chapterid=" + str(ideal.problem_id))
    except Exception as e: 
        return {"result" : "error", "message" : e.__str__(), "stack" : traceback.format_exc()}
开发者ID:InformaticsMskRu,项目名称:informatics-mccme-ru,代码行数:12,代码来源:ideal_solution.py

示例4: problem_set_preliminary

# 需要导入模块: from pynformatics.models import DBSession [as 别名]
# 或者: from pynformatics.models.DBSession import merge [as 别名]
def problem_set_preliminary(request):
    try:
        checkCapability(request)
        problem = DBSession.query(Problem).filter(Problem.id == request.matchdict['problem_id']).first()

        problem.sample_tests = request.params['sample_tests']
        with transaction.manager:
           DBSession.merge(problem)
        return {"result" : "ok", "content" : problem.sample_tests}
    except Exception as e:
        return {"result" : "error", "content" : e.__str__(), "stack" : traceback.format_exc()}
开发者ID:bdolgov,项目名称:ej-ants,代码行数:13,代码来源:problem.py


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