本文整理汇总了Python中pulp.server.db.model.criteria.Criteria.as_dict方法的典型用法代码示例。如果您正苦于以下问题:Python Criteria.as_dict方法的具体用法?Python Criteria.as_dict怎么用?Python Criteria.as_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pulp.server.db.model.criteria.Criteria
的用法示例。
在下文中一共展示了Criteria.as_dict方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from pulp.server.db.model.criteria import Criteria [as 别名]
# 或者: from pulp.server.db.model.criteria.Criteria import as_dict [as 别名]
def post(self, request, consumer_id):
"""
Creates an async task to regenerate content applicability data for given consumer.
:param request: WSGI request object
:type request: django.core.handlers.wsgi.WSGIRequest
:param consumer_id: The consumer ID.
:type consumer_id: str
:raises MissingResource: if some parameters are missing
:raises OperationPostponed: when an async operation is performed.
"""
consumer_query_manager = factory.consumer_query_manager()
if consumer_query_manager.find_by_id(consumer_id) is None:
raise MissingResource(consumer_id=consumer_id)
consumer_criteria = Criteria(filters={'consumer_id': consumer_id})
task_tags = [tags.action_tag('consumer_content_applicability_regeneration')]
async_result = regenerate_applicability_for_consumers.apply_async_with_reservation(
tags.RESOURCE_CONSUMER_TYPE,
consumer_id,
(consumer_criteria.as_dict(),),
tags=task_tags)
raise OperationPostponed(async_result)
示例2: POST
# 需要导入模块: from pulp.server.db.model.criteria import Criteria [as 别名]
# 或者: from pulp.server.db.model.criteria.Criteria import as_dict [as 别名]
def POST(self, consumer_id):
"""
Creates an async task to regenerate content applicability data for given consumer.
:param consumer_id: The consumer ID.
:type consumer_id: basestring
"""
consumer_query_manager = managers.consumer_query_manager()
if consumer_query_manager.find_by_id(consumer_id) is None:
raise MissingResource(consumer_id=consumer_id)
consumer_criteria = Criteria(filters={'consumer_id': consumer_id})
task_tags = [tags.action_tag('consumer_content_applicability_regeneration')]
async_result = regenerate_applicability_for_consumers.apply_async_with_reservation(
tags.RESOURCE_CONSUMER_TYPE,
consumer_id,
(consumer_criteria.as_dict(),),
tags=task_tags)
raise OperationPostponed(async_result)