本文整理汇总了Python中superdesk.errors.PublishQueueError.output_channel_not_found_error方法的典型用法代码示例。如果您正苦于以下问题:Python PublishQueueError.output_channel_not_found_error方法的具体用法?Python PublishQueueError.output_channel_not_found_error怎么用?Python PublishQueueError.output_channel_not_found_error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类superdesk.errors.PublishQueueError
的用法示例。
在下文中一共展示了PublishQueueError.output_channel_not_found_error方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: transmit_items
# 需要导入模块: from superdesk.errors import PublishQueueError [as 别名]
# 或者: from superdesk.errors.PublishQueueError import output_channel_not_found_error [as 别名]
def transmit_items(queue_items, subscriber, destination, output_channels):
failed_items = []
for queue_item in queue_items:
# Check if output channel is active
output_channel = output_channels.get(str(queue_item['output_channel_id']))
if not output_channel:
raise PublishQueueError.output_channel_not_found_error(
Exception('Output Channel: {}'.format(queue_item['output_channel_id'])))
if not output_channel.get('is_active', False):
continue
try:
if not is_on_time(queue_item, destination):
continue
# update the status of the item to in-progress
queue_update = {'state': 'in-progress', 'transmit_started_at': utcnow()}
superdesk.get_resource_service('publish_queue').patch(queue_item.get('_id'), queue_update)
# get the formatted item
formatted_item = superdesk.get_resource_service('formatted_item').\
find_one(req=None, _id=queue_item['formatted_item_id'])
transmitter = superdesk.publish.transmitters[destination.get('delivery_type')]
transmitter.transmit(queue_item, formatted_item, subscriber, destination, output_channel)
update_content_state(queue_item)
except:
failed_items.append(queue_item)
if len(failed_items) > 0:
logger.error('Failed to publish the following items: %s', str(failed_items))