def get_document_types(self, resource, context): # On website we return all document_type document_types = [] skip_formats = set() for resource in get_content_containers(context, skip_formats): skip_formats.add(resource.class_id) for cls in resource.get_document_types(): if cls not in document_types: document_types.append(cls) return document_types
def get_options(cls): context = get_context() allowed_class_ids = cls.get_allowed_class_ids() skip_formats = set() items = [] for resource in get_content_containers(context, skip_formats): for cls in resource.get_document_types(): if cls.class_id in allowed_class_ids: break else: skip_formats.add(resource.class_id) continue path = context.site_root.get_pathto(resource) title = '/' if not path else ('/%s/' % path) # Next items.append({'name': path, 'value': title, 'selected': False}) # Sort items.sort(key=lambda x: x['name']) return items