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


Python CategoryManager._addConference方法代码示例

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


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

示例1: main

# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import _addConference [as 别名]
def main(argv):
    category = -1
    meeting = -1
    show = 0

    try:
        opts, args = getopt.getopt(argv, "hm:c:s", ["help", "meeting=", "category=", "show"])
    except getopt.GetoptError:
        usage()
        sys.exit(2)
    for opt, arg in opts:
        if opt in ("-h", "--help"):
            usage()
            sys.exit()
        elif opt in ("-s", "--show"):
            show = 1
        elif opt in ("-m", "--meeting"):
            meeting = arg
        elif opt in ("-c", "--category"):
            category = arg

    # Create database instance and open trashcan manager object
    DBMgr.getInstance().startRequest()
    t = TrashCanManager()
    conf = None
    if show:
        for i in t.getList():
            if isinstance(i, Conference):
                if meeting != -1 and i.getId() == meeting:
                    print "[%s]%s" % (i.getId(), i.getTitle())
                elif meeting == -1:
                    print "[%s]%s" % (i.getId(), i.getTitle())
        sys.exit()
    if meeting != -1 and category != -1:
        print "Meeting:%s" % meeting
        print "Category:%s" % category
        for i in t.getList():
            if isinstance(i, Conference):
                if i.getId() == meeting:
                    conf = i
                    break

        if conf:
            # Remove the meeting from conference
            t.remove(conf)
            # Attach meeting to desired category
            cat = CategoryManager().getById(category)
            ConferenceHolder().add(conf)
            cat._addConference(conf)

            # Add Evaluation
            c = ConferenceHolder().getById(meeting)
            from MaKaC.evaluation import Evaluation

            c.setEvaluations([Evaluation(c)])

            DBMgr.getInstance().endRequest()
开发者ID:lukasnellen,项目名称:indico,代码行数:59,代码来源:restore_meeting.py

示例2: main

# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import _addConference [as 别名]
def main(argv):
    category = -1
    meeting = -1
    show = 0

    ContextManager.create()

    try:
        opts, args = getopt.getopt(argv, "hm:c:s", ["help","meeting=","category=", "show"])
    except getopt.GetoptError:
        usage()
        sys.exit(2)
    for opt, arg in opts:
        if opt in ("-h", "--help"):
            usage()
            sys.exit()
        elif opt in ("-s","--show"):
            show = 1
        elif opt in ("-m","--meeting"):
            meeting = arg
        elif opt in ("-c","--category"):
            category = arg

    # Create database instance and open trashcan manager object
    DBMgr.getInstance().startRequest()
    t=TrashCanManager()
    conf = None
    if(show):
        for i in t.getList():
            if isinstance(i, Conference):
                if meeting != -1 and i.getId() == meeting:
                    print "[%s]%s"%(i.getId(),i.getTitle())
                elif meeting == -1:
                    print "[%s]%s"%(i.getId(),i.getTitle())
        sys.exit()

    if(meeting != -1 and category != -1):

        print "Meeting:%s"%meeting
        print "Category:%s" % category
        for i in t.getList():
            if isinstance(i,Conference):
                if i.getId() == meeting:
                    conf = i
                    break

        if conf:
            DBMgr.getInstance().sync()

            with RequestListenerContext():

                # Remove meeting from the TrashCanManager
                t.remove(conf)
                # Attach meeting to desired category
                cat = CategoryManager().getById(category)
                ConferenceHolder().add(conf)
                cat._addConference(conf)

                # Add Evaluation
                c = ConferenceHolder().getById(meeting)
                from MaKaC.evaluation import Evaluation
                c.setEvaluations([Evaluation(c)])

                # indexes
                c.indexConf()
                c._notify('created', cat)

                for contrib in c.getContributionList():
                    contrib._notify('created', c)
        else:
            print "not found!"

        DBMgr.getInstance().endRequest()

    ContextManager.destroy()
开发者ID:aninhalacerda,项目名称:indico,代码行数:77,代码来源:restore_meeting.py


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