本文整理汇总了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()
示例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()