本文整理汇总了Python中pulp.server.managers.factory.content_orphan_manager函数的典型用法代码示例。如果您正苦于以下问题:Python content_orphan_manager函数的具体用法?Python content_orphan_manager怎么用?Python content_orphan_manager使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了content_orphan_manager函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: POST
def POST(self):
orphans = self.params()
orphan_manager = factory.content_orphan_manager()
tags = [action_tag('delete_orphans'),
resource_tag(dispatch_constants.RESOURCE_CONTENT_UNIT_TYPE, 'orphans')]
call_request = CallRequest(orphan_manager.delete_orphans_by_id, [orphans], tags=tags, archive=True)
return execution.execute_async(self, call_request)
示例2: DELETE
def DELETE(self, content_type, content_id):
orphan_manager = factory.content_orphan_manager()
orphan_manager.get_orphan(content_type, content_id)
ids = [{'content_type_id': content_type, 'unit_id': content_id}]
tags = [resource_tag(dispatch_constants.RESOURCE_CONTENT_UNIT_TYPE, 'orphans')]
call_request = CallRequest(orphan_manager.delete_orphans_by_id, [ids], tags=tags, archive=True)
return execution.execute_async(self, call_request)
示例3: GET
def GET(self, content_type):
orphan_manager = factory.content_orphan_manager()
# NOTE this can still potentially stomp on memory, but hopefully the
# _with_unit_keys methods will reduce the foot print enough that
# we'll never see this bug again
orphans = list(orphan_manager.generate_orphans_by_type_with_unit_keys(content_type))
map(lambda o: o.update(serialization.link.child_link_obj(o['_id'])), orphans)
return self.ok(orphans)
示例4: delete
def delete(self, request, content_type):
"""
Dispatch a delete_orphans_by_type task.
:param request: WSGI request object
:type request: django.core.handlers.wsgi.WSGIRequest
:param content_type: restrict the list of orphans to be deleted to this content type
:type content_type: str
:raises: OperationPostponed when an async operation is performed
"""
orphan_manager = factory.content_orphan_manager()
orphan_manager.validate_type(content_type)
task_tags = [tags.resource_tag(tags.RESOURCE_CONTENT_UNIT_TYPE, "orphans")]
async_task = content_orphan.delete_orphans_by_type.apply_async((content_type,), tags=task_tags)
raise OperationPostponed(async_task)
示例5: get
def get(self, request, content_type, unit_id):
"""
Return a serialized object representing the requested orphan
:param request: WSGI request object
:type request: django.core.handlers.wsgi.WSGIRequest
:param content_type: content type of the requested orphan
:type content_type: str
:param unit_id: id of the requested unit
:type unit_id: str
:return: response conainting a serialized dict of the requested orphan
:rtype : django.http.HttpResponse
"""
orphan_manager = factory.content_orphan_manager()
orphan_dict = orphan_manager.get_orphan(content_type, unit_id)
orphan_dict["_href"] = request.get_full_path()
return generate_json_response(orphan_dict)
示例6: test_factory
def test_factory(self):
try:
manager_factory.content_orphan_manager()
except:
self.fail(traceback.format_exc())
示例7: GET
def GET(self, content_type, content_id):
orphan_manager = factory.content_orphan_manager()
orphan = orphan_manager.get_orphan(content_type, content_id)
orphan.update(serialization.link.current_link_obj())
return self.ok(orphan)
示例8: clean_orphans
def clean_orphans(self):
"""
Exposes the ability to clean up this unit as an orphan.
"""
orphan_manger = factory.content_orphan_manager()
orphan_manger.delete_orphan_content_units_by_type(self._content_type_id, self.id)