本文整理汇总了Python中mpx.lib.persistent.PersistentDataObject.events方法的典型用法代码示例。如果您正苦于以下问题:Python PersistentDataObject.events方法的具体用法?Python PersistentDataObject.events怎么用?Python PersistentDataObject.events使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpx.lib.persistent.PersistentDataObject
的用法示例。
在下文中一共展示了PersistentDataObject.events方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start
# 需要导入模块: from mpx.lib.persistent import PersistentDataObject [as 别名]
# 或者: from mpx.lib.persistent.PersistentDataObject import events [as 别名]
def start(self):
self.managernode = self.as_node(self.manager)
self.synclock.acquire()
try:
alarmsname = '%s (%s)' % (self.name, 'alarms')
eventsname = '%s (%s)' % (self.name, 'events')
self.alarms = PersistentDictionary(alarmsname,
encode=self.encode,
decode=self.decode)
self.events = PersistentDictionary(eventsname,
encode=self.encode,
decode=self.decode)
# Migrate PDO data from old style persistence.
pdodata = PersistentDataObject(self, dmtype=GC_NEVER)
if os.path.exists(pdodata.filename()):
msglog.log('broadway', msglog.types.INFO,
"Migrating previous alarm and event data")
pdodata.events = {}
pdodata.alarms = {}
pdodata.load()
migrate(pdodata, self.decode)
self.rebuildstorage()
pdodata.destroy()
del(pdodata)
finally:
self.synclock.release()
self.securitymanager = self.as_node('/services/Security Manager')
register = self.managernode.register_for_type
self.sub = register(self.handle_event, StateEvent)
self.running.set()
super(AlarmConfigurator, self).start()