本文整理匯總了Python中cyclone.util.ObjectDict.storm_id方法的典型用法代碼示例。如果您正苦於以下問題:Python ObjectDict.storm_id方法的具體用法?Python ObjectDict.storm_id怎麽用?Python ObjectDict.storm_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cyclone.util.ObjectDict
的用法示例。
在下文中一共展示了ObjectDict.storm_id方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: load_complete_events
# 需要導入模塊: from cyclone.util import ObjectDict [as 別名]
# 或者: from cyclone.util.ObjectDict import storm_id [as 別名]
def load_complete_events(store, event_number=GLSetting.notification_limit):
"""
_complete_ is explicit because do not serialize, but make an OD() of the description.
event_number represent the amount of event that can be returned by the function,
event to be notified are taken in account later.
"""
node_desc = db_admin_serialize_node(store, GLSetting.defaults.language)
event_list = []
storedevnts = store.find(EventLogs, EventLogs.mail_sent == False)
storedevnts.order_by(Asc(EventLogs.creation_date))
debug_event_counter = {}
for i, stev in enumerate(storedevnts):
if len(event_list) == event_number:
log.debug("Maximum number of notification event reach (Mailflush) %d, after %d" %
(event_number, i))
break
debug_event_counter.setdefault(stev.event_reference['kind'], 0)
debug_event_counter[stev.event_reference['kind']] += 1
if not stev.description['receiver_info']['tip_notification']:
continue
eventcomplete = OD()
# node level information are not stored in the node, but fetch now
eventcomplete.notification_settings = admin_serialize_notification(
store.find(Notification).one(), stev.description['receiver_info']['language']
)
eventcomplete.node_info = node_desc
# event level information are decoded form DB in the old 'Event'|nametuple format:
eventcomplete.receiver_info = stev.description['receiver_info']
eventcomplete.tip_info = stev.description['tip_info']
eventcomplete.subevent_info = stev.description['subevent_info']
eventcomplete.context_info = stev.description['context_info']
eventcomplete.steps_info = stev.description['steps_info']
eventcomplete.type = stev.description['type'] # 'Tip', 'Comment'
eventcomplete.trigger = stev.event_reference['kind'] # 'plaintext_blah' ...
eventcomplete.storm_id = stev.id
event_list.append(eventcomplete)
if debug_event_counter:
log.debug("load_complete_events: %s" % debug_event_counter)
return event_list