本文整理汇总了Python中superdesk.errors.PublishQueueError.bad_schedule_error方法的典型用法代码示例。如果您正苦于以下问题:Python PublishQueueError.bad_schedule_error方法的具体用法?Python PublishQueueError.bad_schedule_error怎么用?Python PublishQueueError.bad_schedule_error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类superdesk.errors.PublishQueueError
的用法示例。
在下文中一共展示了PublishQueueError.bad_schedule_error方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_close_subscriber_does_close
# 需要导入模块: from superdesk.errors import PublishQueueError [as 别名]
# 或者: from superdesk.errors.PublishQueueError import bad_schedule_error [as 别名]
def test_close_subscriber_does_close(self):
with self.app.app_context():
subscriber = self.app.data.find("subscribers", None, None)[0]
self.assertTrue(subscriber.get("is_active"))
PublishService().close_transmitter(subscriber, PublishQueueError.bad_schedule_error())
subscriber = self.app.data.find("subscribers", None, None)[0]
self.assertFalse(subscriber.get("is_active"))
示例2: test_close_output_channel_does_close
# 需要导入模块: from superdesk.errors import PublishQueueError [as 别名]
# 或者: from superdesk.errors.PublishQueueError import bad_schedule_error [as 别名]
def test_close_output_channel_does_close(self):
with self.app.app_context():
output_channel = self.app.data.find('output_channels', None, None)[1]
self.assertTrue(output_channel.get('is_active'))
PublishService().close_transmitter(output_channel, 'output_channels',
PublishQueueError.bad_schedule_error())
output_channel = self.app.data.find('output_channels', None, None)[1]
self.assertFalse(output_channel.get('is_active'))
示例3: is_on_time
# 需要导入模块: from superdesk.errors import PublishQueueError [as 别名]
# 或者: from superdesk.errors.PublishQueueError import bad_schedule_error [as 别名]
def is_on_time(queue_item, destination):
"""
Checks if the item is ready to be processed
:param queue_item: item to be checked
:return: True if the item is ready
"""
try:
if queue_item.get('publish_schedule'):
publish_schedule = queue_item['publish_schedule']
if type(publish_schedule) is not datetime:
raise PublishQueueError.bad_schedule_error(Exception("Schedule is not datetime"),
destination)
return utcnow() >= publish_schedule
return True
except PublishQueueError:
raise
except Exception as ex:
raise PublishQueueError.bad_schedule_error(ex, destination)
示例4: mock_transmit
# 需要导入模块: from superdesk.errors import PublishQueueError [as 别名]
# 或者: from superdesk.errors.PublishQueueError import bad_schedule_error [as 别名]
def mock_transmit(*args):
raise PublishQueueError.bad_schedule_error()