本文整理汇总了Python中MaKaC.common.indexes.IndexesHolder类的典型用法代码示例。如果您正苦于以下问题:Python IndexesHolder类的具体用法?Python IndexesHolder怎么用?Python IndexesHolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IndexesHolder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: iter_bookings
def iter_bookings(self, idList, categ_id=None):
for vsid in idList:
if vsid in ["webcast", "recording"]:
idx = Catalog.getIdx("cs_booking_instance")[self.ID_TO_IDX[vsid]]
for __, bkw in idx.iter_bookings(self._fromDT, self._toDT):
yield bkw
else:
idx = IndexesHolder().getById("collaboration")
dateFormat = "%d/%m/%Y"
tempBookings = idx.getBookings(
self.ID_TO_IDX[vsid],
"conferenceStartDate",
self._orderBy,
self._fromDT,
self._toDT,
"UTC",
False,
None,
categ_id,
False,
dateFormat,
).getResults()
for evt, bks in tempBookings:
for bk in bks:
bk._conf = evt # Ensure all CSBookings are aware of their Conference
yield bk
示例2: collaborationRequestIndexCreate
def collaborationRequestIndexCreate(dbi, withRBDB, prevVersion):
"""
Creating new "All Requests" index
"""
ci = IndexesHolder().getById('collaboration')
ci.indexAll(index_names=['All Requests'], dbi=dbi)
dbi.commit()
示例3: cacheDay
def cacheDay(dest, day):
"""
Cache a day, by calling wget in "mirror" mode
"""
dbi = DBMgr.getInstance()
dbi.startRequest()
index = {}
calIdx = IndexesHolder().getIndex('calendar')
objs = calIdx.getObjectsInDay(day)
for confId in objs:
if confId == '': continue
obj = ConferenceHolder().getById(confId)
url = str(urlHandlers.UHConferenceDisplay.getURL(obj))
savedDirs = re.match(r'http:\/\/(.*)', url).group(1).split('/')
print "Calling wget for %s..." % url
os.system(WGET_COMMAND % (confId, url,
os.path.join(dest, confId),
savedDirs[0]))
print "done!"
index[confId] = (os.path.join(confId,*savedDirs)+'.html', obj.getTitle())
dbi.endRequest(False)
return index
示例4: video
def video(self, idList, alarm = None):
idx = IndexesHolder().getById('collaboration');
bookings = []
dateFormat = '%d/%m/%Y'
self._alarm = alarm
for vsid in idList:
tempBookings = idx.getBookings(self.ID_TO_IDX[vsid], "conferenceStartDate",
self._orderBy, self._fromDT, self._toDT,
'UTC', False, None, None, False, dateFormat)
bookings.extend(tempBookings.getResults())
def _iter_bookings(objs):
for obj in objs:
for bk in obj[1]:
bk._conf = obj[0] # Ensure all CSBookings are aware of their Conference
""" This is for plugins whose structure include 'talkSelected',
examples of which in CERN Indico being WebcastRequest and
RecordingRequest.
"""
if bk.hasTalkSelection():
ts = bk.getTalkSelectionList()
contributions = []
if ts is None: # No individual talks, therefore an event for every contribution
contributions = bk._conf.getContributionList()
else:
for contribId in ts:
tempContrib = bk._conf.getContributionById(contribId)
contributions.append(tempContrib)
if len(contributions) == 0 or self._detail == "event": # If we are here, no contributions but a request exists.
bk.setStartDate(bk._conf.getStartDate())
bk.setEndDate(bk._conf.getEndDate())
yield bk
else: # Contributions is the list of all to be exported now
contributions = filter(lambda c: c.isScheduled(), contributions)
for contrib in contributions:
# Wrap the CSBooking object for export
bkw = CSBookingContributionWrapper(bk, contrib)
bkw.setStartDate(contrib.getStartDate())
bkw.setEndDate(contrib.getEndDate())
yield bkw
else:
yield bk
""" Simple filter, as this method can return None for Pending and True
for accepted, both are valid booking statuses for exporting.
"""
def _filter(obj):
return obj.getAcceptRejectStatus() is not False
iface = self.DETAIL_INTERFACES.get('all')
for booking in self._process(_iter_bookings(bookings), _filter, iface):
yield booking
示例5: iter_interesting_events
def iter_interesting_events(avatar, data):
idx = IndexesHolder().getById('categoryDateAll')
now_local = utc2server(nowutc(), False)
aw = AccessWrapper()
aw.setUser(avatar)
for event in _unique_events(idx.iterateObjectsIn('0', now_local, now_local + timedelta(weeks=24))):
if _is_event_interesting(avatar, event, data) and event.canAccess(aw):
yield event
示例6: call
def call(self):
cf = ConferenceHolder()
for conf in cf.getValuesToList():
csbm = Catalog.getIdx("cs_bookingmanager_conference").get(conf.getId())
csbm._bookings = {}
csbm._bookingsByType = {}
collaborationIndex = IndexesHolder().getById("collaboration")
collaborationIndex.cleanAll()
示例7: call
def call(self):
cf = ConferenceHolder()
for conf in cf.getValuesToList():
csbm = conf.getCSBookingManager()
csbm._bookings = {}
csbm._bookingsByType = {}
collaborationIndex = IndexesHolder().getById("collaboration")
collaborationIndex.cleanAll()
示例8: setUp
def setUp(self):
DBMgr.getInstance().startRequest()
self.oldIndex = IndexesHolder()._getIdx()["categoryDateLtd"]
self.newIndex = IndexesHolder()._getIdx()["categoryDate"]
self.startDate = datetime(2010,5,13, 10, 0, 0, tzinfo=timezone('UTC'))
self.endDate = datetime(2010,5,14, 14, 0, 0, tzinfo=timezone('UTC'))
self.ch = ConferenceHolder()
self.categId = '0'
示例9: initialize
def initialize(self, dbi=None):
# empty tree
self.clear()
idx = IndexesHolder().getById('collaboration')
for conf, bks in idx.getBookings(self.index_name, 'conferenceStartDate', None, None, None).getResults():
for bk in bks:
self.index_booking(bk)
示例10: setPassportOrigin
def setPassportOrigin(self,value,item=None):
index = IndexesHolder().getById("registrants")
index.unindex(self)
self._passportOrigin = value
if item:
self._passportOrigin_item = item
elif self._passportOrigin_item:
self._passportOrigin_item.setValue(value)
index.index(self)
示例11: indexConferenceTitle
def indexConferenceTitle(dbi, withRBDB, prevVersion):
"""
Indexing Conference Title
"""
ch = ConferenceHolder()
nameIdx = IndexesHolder().getIndex('conferenceTitle')
i = 0
for (__, conf) in console.conferenceHolderIterator(ch, deepness='event'):
nameIdx.index(conf.getId(), conf.getTitle().decode('utf-8'))
i += 1
if i % 10000 == 0:
dbi.commit()
示例12: export_event
def export_event(self, aw):
ch = ConferenceHolder()
index = IndexesHolder().getIndex('conferenceTitle')
try:
query = ' AND '.join(map(lambda y: "*%s*" % y, filter(lambda x: len(x) > 0, self._search.split(' '))))
results = index.search(query)
except parsetree.ParseError:
results = []
d = []
for id, v in results:
event = ch.getById(id)
if event.canAccess(aw):
d.append({'id': id, 'title': event.getTitle(), 'startDate': event.getStartDate(), 'hasAnyProtection': event.hasAnyProtection()})
return d
示例13: reindexCategoryNameAndConferenceTitle
def reindexCategoryNameAndConferenceTitle(dbi, withRBDB, prevVersion):
"""
Indexing Conference Title with new WhooshTextIndex
"""
IndexesHolder().removeById('conferenceTitle')
IndexesHolder().removeById('categoryName')
confTitleIdx = IndexesHolder().getIndex('conferenceTitle')
categNameIdx = IndexesHolder().getIndex('categoryName')
dbi.commit()
confTitleIdx.clear()
confTitleIdx.initialize(dbi, ConferenceHolder().itervalues())
categNameIdx.clear()
categNameIdx.initialize(dbi, CategoryManager().itervalues())
示例14: reindexCategoryNameAndConferenceTitle
def reindexCategoryNameAndConferenceTitle(dbi, prevVersion):
"""
Indexing Conference Title with new WhooshTextIndex
"""
IndexesHolder().removeById('conferenceTitle')
IndexesHolder().removeById('categoryName')
confTitleIdx = IndexesHolder().getIndex('conferenceTitle')
categNameIdx = IndexesHolder().getIndex('categoryName')
dbi.commit()
iterator = (x[1] for x in console.conferenceHolderIterator(ConferenceHolder(), deepness='event'))
confTitleIdx.clear()
confTitleIdx.initialize(dbi, iterator)
categNameIdx.clear()
categNameIdx.initialize(dbi, CategoryManager().itervalues())
示例15: _getAnswer
def _getAnswer(self):
ci = IndexesHolder().getById('collaboration')
return ci.getBookings(self._indexName,
self._viewBy,
self._orderBy,
self._minKey,
self._maxKey,
tz = self._tz,
onlyPending = self._onlyPending,
conferenceId = self._conferenceId,
categoryId = self._categoryId,
pickle = True,
dateFormat='%a %d %b %Y',
page = self._page,
resultsPerPage = self._resultsPerPage,
grouped=True)