本文整理汇总了Python中keep.common.fedora.Repository.get_objects_with_cmodel方法的典型用法代码示例。如果您正苦于以下问题:Python Repository.get_objects_with_cmodel方法的具体用法?Python Repository.get_objects_with_cmodel怎么用?Python Repository.get_objects_with_cmodel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类keep.common.fedora.Repository
的用法示例。
在下文中一共展示了Repository.get_objects_with_cmodel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle
# 需要导入模块: from keep.common.fedora import Repository [as 别名]
# 或者: from keep.common.fedora.Repository import get_objects_with_cmodel [as 别名]
def handle(self, *args, **options):
self.options = options
self.repaired_count = 0
self.unrepaired_count = 0
repo = Repository()
self.pidman = DjangoPidmanRestClient()
# populate list of objects to be processed
objects = []
for pid in args:
try:
obj = repo.get_object(pid=pid, type=CollectionObject)
if obj.has_requisite_content_models:
objects.append(obj)
else:
obj = repo.get_object(pid=pid, type=AudioObject)
if obj.has_requisite_content_models:
objects.append(obj)
except Exception:
self.log(message="Could not find Collection or Audio object for: %s" % pid)
# get list of all collections from the repository
# limited to the COLLECTION_CONTENT_MODEL as well as returns a Keep specific collection object
if not args:
objects = repo.get_objects_with_cmodel(CollectionObject.COLLECTION_CONTENT_MODEL, type=CollectionObject)
if not objects:
self.log(message="No Collections were found.")
for obj in objects:
self.repair_ark(obj)
self.log(message="\n\n%s ARKs repaired\n%s ARKs were not repaired" % (self.repaired_count, self.unrepaired_count), no_label=True)