當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。