本文整理汇总了Python中MaKaC.common.indexes.IndexesHolder.indexConference方法的典型用法代码示例。如果您正苦于以下问题:Python IndexesHolder.indexConference方法的具体用法?Python IndexesHolder.indexConference怎么用?Python IndexesHolder.indexConference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MaKaC.common.indexes.IndexesHolder
的用法示例。
在下文中一共展示了IndexesHolder.indexConference方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: reindex
# 需要导入模块: from MaKaC.common.indexes import IndexesHolder [as 别名]
# 或者: from MaKaC.common.indexes.IndexesHolder import indexConference [as 别名]
def reindex(fix=False,fromDate=None):
""" Recreate deleted obj indices, from the DOH """
dbi = DBMgr.getInstance()
dbi.startRequest()
pubConfIdx = IndexesHolder().getIndex('OAIDeletedConferenceModificationDate')
prvConfIdx = IndexesHolder().getIndex('OAIDeletedPrivateConferenceModificationDate')
pubContIdx = IndexesHolder().getIndex('OAIDeletedContributionModificationDate')
prvContIdx = IndexesHolder().getIndex('OAIDeletedPrivateContributionModificationDate')
doh = DeletedObjectHolder()
pubConfIdx.initIndex()
pubContIdx.initIndex()
prvConfIdx.initIndex()
prvContIdx.initIndex()
fromDateParsed_tz = datetime.datetime(*time.strptime(fromDate,'%Y-%m-%d')[:6],**{'tzinfo':timezone('UTC')})
fromDateParsed_naive = datetime.datetime(*time.strptime(fromDate,'%Y-%m-%d')[:6])
for obj in doh.getList():
if fromDate:
if obj.getOAIModificationDate().tzinfo:
fromDateParsed = fromDateParsed_tz
else:
fromDateParsed = fromDateParsed_naive
if obj.getOAIModificationDate() < fromDateParsed:
continue
if not hasattr(obj,'protected'):
print "NO DATA FOR %s (%s)" % (obj.getId(), obj.getOAIModificationDate())
continue
print "indexing %s (%s)" % (prettyPrint(obj), obj.getOAIModificationDate())
if obj._objClass == Conference:
if obj.protected:
prvConfIdx.indexConference(obj)
else:
pubConfIdx.indexConference(obj)
elif obj._objClass == Contribution or obj._objClass == AcceptedContribution or obj._objClass == SubContribution:
if obj.protected:
prvContIdx.indexContribution(obj)
else:
pubContIdx.indexContribution(obj)
dbi.commit()
dbi.endRequest()