invenio_records_ui/views.py
def create_url_rule(endpoint, route=None, pid_type=None, template=None,
                    permission_factory_imp=None, view_imp=None,
                    record_class=None, methods=None):
    """Create Werkzeug URL rule for a specific endpoint.

    The method takes care of creating a persistent identifier resolver
    for the given persistent identifier type.

    :param endpoint: Name of endpoint.
    :param route: URL route (must include ``<pid_value>`` pattern). Required.
    :param pid_type: Persistent identifier type for endpoint. Required.
    :param template: Template to render.
        (Default: ``invenio_records_ui/detail.html``)
    :param permission_factory_imp: Import path to factory that creates a
        permission object for a given record.
    :param view_imp: Import path to view function. (Default: ``None``)
    :param record_class: Name of the record API class.
    :param methods: Method allowed for the endpoint.
    :returns: A dictionary that can be passed as keywords arguments to
        ``Blueprint.add_url_rule``.
    """
    assert route
    assert pid_type

    permission_factory = import_string(permission_factory_imp) if \
        permission_factory_imp else None
    view_method = import_string(view_imp) if view_imp else default_view_method
    record_class = import_string(record_class) if record_class else Record
    methods = methods or ['GET']

    view_func = partial(
        record_view,
        resolver=Resolver(pid_type=pid_type, object_type='rec',
                          getter=record_class.get_record),
        template=template or 'invenio_records_ui/detail.html',
        permission_factory=permission_factory,
        view_method=view_method)
    # Make view well-behaved for Flask-DebugToolbar
    view_func.__module__ = record_view.__module__
    view_func.__name__ = record_view.__name__

    return dict(
        endpoint=endpoint,
        rule=route,
        view_func=view_func,
        methods=methods,
    )
def create_url_rule(endpoint, route=None, pid_type=None, template=None,
                    permission_factory_imp=None, view_imp=None,
                    record_class=None, methods=None):
    assert route
    assert pid_type

    permission_factory = import_string(permission_factory_imp) if \
        permission_factory_imp else None
    view_method = import_string(view_imp) if view_imp else default_view_method
    record_class = import_string(record_class) if record_class else Record
    methods = methods or ['GET']

    view_func = partial(
        record_view,
        resolver=Resolver(pid_type=pid_type, object_type='rec',
                          getter=record_class.get_record),
        template=template or 'invenio_records_ui/detail.html',
        permission_factory=permission_factory,
        view_method=view_method)
    # Make view well-behaved for Flask-DebugToolbar
    view_func.__module__ = record_view.__module__
    view_func.__name__ = record_view.__name__

    return dict(
        endpoint=endpoint,
        rule=route,
        view_func=view_func,
        methods=methods,
    )
def create_url_rule ( endpoint , route = None , pid_type = None , template = None , permission_factory_imp = None , view_imp = None , record_class = None , methods = None ) : assert route assert pid_type permission_factory = import_string ( permission_factory_imp ) if permission_factory_imp else None view_method = import_string ( view_imp ) if view_imp else default_view_method record_class = import_string ( record_class ) if record_class else Record methods = methods or [ 'GET' ] view_func = partial ( record_view , resolver = Resolver ( pid_type = pid_type , object_type = 'rec' , getter = record_class . get_record ) , template = template or 'invenio_records_ui/detail.html' , permission_factory = permission_factory , view_method = view_method ) # Make view well-behaved for Flask-DebugToolbar view_func . __module__ = record_view . __module__ view_func . __name__ = record_view . __name__ return dict ( endpoint = endpoint , rule = route , view_func = view_func , methods = methods , )
Create Werkzeug URL rule for a specific endpoint.

    The method takes care of creating a persistent identifier resolver
    for the given persistent identifier type.

    :param endpoint: Name of endpoint.
    :param route: URL route (must include ``<pid_value>`` pattern). Required.
    :param pid_type: Persistent identifier type for endpoint. Required.
    :param template: Template to render.
        (Default: ``invenio_records_ui/detail.html``)
    :param permission_factory_imp: Import path to factory that creates a
        permission object for a given record.
    :param view_imp: Import path to view function. (Default: ``None``)
    :param record_class: Name of the record API class.
    :param methods: Method allowed for the endpoint.
    :returns: A dictionary that can be passed as keywords arguments to
        ``Blueprint.add_url_rule``.
Create Werkzeug URL rule for a specific endpoint .