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


Python CategoryManager.getList方法代码示例

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


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

示例1: main

# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getList [as 别名]
def main():
    """This script deletes existing category indexes and recreates them."""
    db.DBMgr.getInstance().startRequest()
    im = indexes.IndexesHolder()
    im.removeById('category')
    catIdx = im.getIndex('category')
    ch = CategoryManager()
    totnum = len(ch.getList())
    curnum = 0
    curper = 0
    for cat in ch.getList():
        while 1:
            try:
                for conf in cat.getConferenceList():
                    catIdx.indexConf(conf)
                transaction.commit()
                break
            except:
                db.DBMgr.getInstance().sync()
        curnum += 1
        per = int(float(curnum)/float(totnum)*100)
        if per != curper:
            curper = per
            print "%s%%" % per
    db.DBMgr.getInstance().endRequest()
开发者ID:bubbas,项目名称:indico,代码行数:27,代码来源:reindexcategories.py

示例2: main

# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getList [as 别名]
def main():
    DBMgr.getInstance().startRequest()
    im = indexes.IndexesHolder()
    im.removeById("calendar")
    DBMgr.getInstance().commit()
    ch = CategoryManager()
    list = ch.getList()
    totnum = len(list)
    curnum = 0
    curper = 0
    for cat in list:
        committed = False
        DBMgr.getInstance().sync()
        calindex = im.getIndex("calendar")
        while not committed:
            try:
                del cat._calIdx
            except:
                pass
            for conf in cat.getConferenceList():
                calindex.indexConf(conf)
            try:
                DBMgr.getInstance().commit()
                committed = True
            except:
                DBMgr.getInstance().abort()
                print "retry %s" % cat.getId()
        curnum += 1
        per = int(float(curnum) / float(totnum) * 100)
        if per != curper:
            curper = per
            if per in [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]:
                print "done %s%%" % per
    DBMgr.getInstance().endRequest()
开发者ID:k3njiy,项目名称:indico,代码行数:36,代码来源:reindexcalendars.py

示例3: main

# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getList [as 别名]
def main():
    """This script deletes existing category indexes and recreates them."""
    db.DBMgr.getInstance().startRequest()
    ch = CategoryManager()
    for cat in ch.getList():
      for conf in cat.getConferenceList():
        chconf(conf)
      get_transaction().commit()
    # Tasks
    htl = timerExec.HelperTaskList.getTaskListInstance()
    for task in htl.getTasks():
        chtask(task)
    db.DBMgr.getInstance().endRequest()
开发者ID:davidmorrison,项目名称:indico,代码行数:15,代码来源:chdatetime.py

示例4: main

# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getList [as 别名]
def main():
    """This script deletes existing category indexes and recreates them."""
    dbi = db.DBMgr.getInstance()
    dbi.startRequest()
    im = indexes.IndexesHolder()
    im.removeById('categoryName')
    catIdx = im.getIndex('categoryName')
    ch = CategoryManager()
    totnum = len(ch.getList())
    curnum = 0
    curper = 0
    for cat in ch.getList():
        while 1:
            print cat.getId(), cat.getTitle()
            catIdx.index(cat.getId(), cat.getTitle().decode('utf-8'))
            dbi.commit()
            break
        curnum += 1
        per = int(float(curnum)/float(totnum)*100)
        if per != curper:
            curper = per
            print "%s%%" % per
    dbi.endRequest()
开发者ID:aninhalacerda,项目名称:indico,代码行数:25,代码来源:reindexcategorynameindex.py

示例5: updateCategsAndEvents

# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getList [as 别名]
def updateCategsAndEvents():

    DBMgr.getInstance().startRequest()
    cm = CategoryManager()
    l = [cat.getId() for cat in cm.getList()]
    DBMgr.getInstance().endRequest()
    for id in l:
        DBMgr.getInstance().startRequest()
        cat = cm.getById(id)
        log("\nupdate category %s:%s"%(cat.getId(), cat.getName()))
        if cat.getId() in catTZMap.keys() and catTZMap[cat.getId()] :
            tz = catTZMap[cat.getId()]
            log("    found tz for this category: %s"%tz)
        else:
            tz = defTZ
            log("    use default tz: %s"%tz)
        cat.setTimezone(tz)
        updateCatTasks(cat)
        for conf in cat.getConferenceList():
            updateEvent(conf, tz)
            log("  conf %s: %s updated with tz: %s"%(conf.getId(), conf.getTitle(), tz))
        DBMgr.getInstance().endRequest()
开发者ID:Ictp,项目名称:indico,代码行数:24,代码来源:TZMigration.py

示例6: updateCalendarIndex

# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getList [as 别名]
def updateCalendarIndex():
    DBMgr.getInstance().startRequest()
    im = indexes.IndexesHolder()
    im.removeById('calendar')
    DBMgr.getInstance().commit()
    ch = CategoryManager()
    list = ch.getList()
    totnum = len(list)
    curnum = 0
    curper = 0
    for cat in list:
        committed = False
        DBMgr.getInstance().sync()
        calindex = im.getIndex('calendar')
        while not committed:
            try:
                del cat._calIdx
            except:
                pass
            for conf in cat.getConferenceList():
                try:
                    calindex.indexConf(conf)
                except Exception,e:
                    log("%s"%e)
                    log("calindex: exception indexing [%s] sd:%s, ed:%s"%(conf.getId(),conf.getStartDate(), conf.getEndDate()))
            try:
                DBMgr.getInstance().commit()
                committed = True
            except:
                DBMgr.getInstance().abort()
                log("retry %s" % cat.getId())
        curnum += 1
        per = int(float(curnum)/float(totnum)*100)
        if per != curper:
            curper = per
            if per in [0,10,20,30,40,50,60,70,80,90,100]:
                log("done %s%%" % per)
开发者ID:Ictp,项目名称:indico,代码行数:39,代码来源:TZMigration.py


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