本文整理汇总了Python中superdesk.errors.PublishQueueError.content_update_error方法的典型用法代码示例。如果您正苦于以下问题:Python PublishQueueError.content_update_error方法的具体用法?Python PublishQueueError.content_update_error怎么用?Python PublishQueueError.content_update_error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类superdesk.errors.PublishQueueError
的用法示例。
在下文中一共展示了PublishQueueError.content_update_error方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_content_state
# 需要导入模块: from superdesk.errors import PublishQueueError [as 别名]
# 或者: from superdesk.errors.PublishQueueError import content_update_error [as 别名]
def update_content_state(queue_item):
"""
Updates the state of the content item to published, in archive and published collections.
"""
if queue_item.get('publish_schedule'):
try:
item_update = {'state': 'published'}
get_resource_service('archive').patch(queue_item['item_id'], item_update)
get_resource_service('published').update_published_items(queue_item['item_id'], 'state', 'published')
except Exception as ex:
raise PublishQueueError.content_update_error(ex)
示例2: update_content_state
# 需要导入模块: from superdesk.errors import PublishQueueError [as 别名]
# 或者: from superdesk.errors.PublishQueueError import content_update_error [as 别名]
def update_content_state(queue_item):
"""
Updates the state of the content item to published
In archive and published repos
:param queue_item:
:return:
"""
if queue_item.get('publish_schedule'):
try:
item_update = {'state': 'published'}
superdesk.get_resource_service('archive').patch(queue_item['item_id'], item_update)
superdesk.get_resource_service('published').\
update_published_items(queue_item['item_id'], 'state', 'published')
except Exception as ex:
raise PublishQueueError.content_update_error(ex)