Пример #1
0
    def get_options(cls):
        context = get_context()
        class_id = context.query['type']

        items = []
        for resource in get_content_containers(context, class_id):
            path = resource.abspath
            title = '/' if not path else ('%s/' % path)
            items.append({'name': path, 'value': title, 'selected': False})

        # Sort
        items.sort(key=lambda x: x['name'])
        return items
Пример #2
0
    def get_options(cls):
        context = get_context()
        class_id = context.query['type']

        items = []
        for resource in get_content_containers(context, class_id):
            path = resource.abspath
            title = '/' if not path else ('%s/' % path)
            items.append({'name': path, 'value': title, 'selected': False})

        # Sort
        items.sort(key=lambda x: x['name'])
        return items
Пример #3
0
    def get_items(self, resource, context):
        # 1. Static classes
        aux = set()
        document_types = []
        for container in get_content_containers(context):
            if container.class_id in aux:
                continue
            aux.add(container.class_id)
            for cls in container.get_document_types():
                if cls not in document_types:
                    document_types.append(cls)

        # 2. Add dynamic models
        for cls in context.database.get_dynamic_classes():
            document_types.append(cls)

        # Ok
        return document_types
Пример #4
0
    def get_items(self, resource, context):
        # 1. Static classes
        aux = set()
        document_types = []
        for container in get_content_containers(context):
            if container.class_id in aux:
                continue
            aux.add(container.class_id)
            for cls in container.get_document_types():
                if cls not in document_types:
                    document_types.append(cls)

        # 2. Add dynamic models
        for cls in context.database.get_dynamic_classes():
            document_types.append(cls)

        # Ok
        return document_types