本文整理汇总了Python中indico.modules.events.models.settings.EventSetting.find方法的典型用法代码示例。如果您正苦于以下问题:Python EventSetting.find方法的具体用法?Python EventSetting.find怎么用?Python EventSetting.find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类indico.modules.events.models.settings.EventSetting
的用法示例。
在下文中一共展示了EventSetting.find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: migrate_legacy_events
# 需要导入模块: from indico.modules.events.models.settings import EventSetting [as 别名]
# 或者: from indico.modules.events.models.settings.EventSetting import find [as 别名]
def migrate_legacy_events(self):
print cformat('%{white!}migrating legacy events')
# XXX: removed display manager / internal page manager update
# don't forget to handle them when updating this for 2.0!
wfr = WebFactoryRegistry()._getConfRegistry()
for event in self._committing_iterator(self._get_events()):
if not hasattr(event, '_old_id'):
new_id = self.gen_event_id()
event.unindexConf()
del self.zodb_root['conferences'][event.id]
wf = wfr.pop(event.id, None)
event._old_id = event.id
event.id = new_id
if wf is not None:
wfr[event.id] = wf
self.zodb_root['conferences'][event.id] = event
event.indexConf()
EventSetting.find(event_id=event._old_id).update({EventSetting.event_id: event.id})
EventSettingPrincipal.find(event_id=event._old_id).update({EventSettingPrincipal.event_id: event.id})
db.session.add(LegacyEventMapping(legacy_event_id=event._old_id, event_id=int(event.id)))
if not self.quiet:
self.print_success(cformat('%{cyan}{}').format(event.id), event_id=event._old_id)
else:
# happens if this importer was executed before but you want to add the mapping to your DB again
db.session.add(LegacyEventMapping(legacy_event_id=event._old_id, event_id=int(event.id)))
if not self.quiet:
self.print_success(cformat('%{cyan}{}%{reset} %{yellow}(already updated in zodb)').format(event.id),
event_id=event._old_id)
示例2: migrate_legacy_events
# 需要导入模块: from indico.modules.events.models.settings import EventSetting [as 别名]
# 或者: from indico.modules.events.models.settings.EventSetting import find [as 别名]
def migrate_legacy_events(self):
print cformat('%{white!}migrating legacy events')
dmr = ConfDisplayMgrRegistery()._getDisplayMgrRegistery()
wfr = WebFactoryRegistry()._getConfRegistry()
ipmr = InternalPagesMgrRegistery()._getInternalPagesMgrRegistery()
for event in self._committing_iterator(self._get_events()):
if not hasattr(event, '_old_id'):
new_id = self.gen_event_id()
event.unindexConf()
del self.zodb_root['conferences'][event.id]
dm = dmr.pop(event.id, None)
wf = wfr.pop(event.id, None)
ipm = ipmr.pop(event.id, None)
event._old_id = event.id
event.id = new_id
if dm is not None:
dmr[event.id] = dm
if wf is not None:
wfr[event.id] = wf
if ipm is not None:
ipmr[event.id] = ipm
self.zodb_root['conferences'][event.id] = event
event.indexConf()
IndexedEvent.find(id=event._old_id).update({IndexedEvent.id: event.id})
EventSetting.find(event_id=event._old_id).update({EventSetting.event_id: event.id})
EventSettingPrincipal.find(event_id=event._old_id).update({EventSettingPrincipal.event_id: event.id})
db.session.add(LegacyEventMapping(legacy_event_id=event._old_id, event_id=int(event.id)))
print cformat('%{green}+++%{reset} '
'%{white!}{:6s}%{reset} %{cyan}{}').format(event._old_id, int(event.id))
else:
# happens if this importer was executed before but you want to add the mapping to your DB again
db.session.add(LegacyEventMapping(legacy_event_id=event._old_id, event_id=int(event.id)))
msg = cformat('%{green}+++%{reset} '
'%{white!}{:6s}%{reset} %{cyan}{}%{reset} %{yellow}(already updated in zodb)')
print msg.format(event._old_id, int(event.id))
示例3: query
# 需要导入模块: from indico.modules.events.models.settings import EventSetting [as 别名]
# 或者: from indico.modules.events.models.settings.EventSetting import find [as 别名]
def query(self):
"""Returns a query object filtering by the proxy's module."""
return EventSetting.find(module=self.module)