コード例 #1
0
def register_dataset_plugin_rules(blueprint):
    blueprint.add_url_rule(u'/', view_func=search, strict_slashes=False)
    blueprint.add_url_rule(u'/new', view_func=CreateView.as_view(str(u'new')))
    blueprint.add_url_rule(u'/<id>', view_func=read)
    blueprint.add_url_rule(u'/resources/<id>', view_func=resources)
    blueprint.add_url_rule(u'/edit/<id>',
                           view_func=EditView.as_view(str(u'edit')))
    blueprint.add_url_rule(u'/delete/<id>',
                           view_func=DeleteView.as_view(str(u'delete')))
    blueprint.add_url_rule(u'/follow/<id>',
                           view_func=follow,
                           methods=(u'POST', ))
    blueprint.add_url_rule(u'/unfollow/<id>',
                           view_func=unfollow,
                           methods=(u'POST', ))
    blueprint.add_url_rule(u'/followers/<id>', view_func=followers)
    blueprint.add_url_rule(u'/groups/<id>',
                           view_func=GroupView.as_view(str(u'groups')))
    blueprint.add_url_rule(u'/activity/<id>', view_func=activity)
    blueprint.add_url_rule(u'/<id>/history', view_func=history)

    # Duplicate resource create and edit for backward compatibility. Note,
    # we cannot use resource.CreateView directly here, because of
    # circular imports
    blueprint.add_url_rule(u'/new_resource/<id>',
                           view_func=LazyView(
                               u'ckan.views.resource.CreateView',
                               str(u'new_resource')))

    blueprint.add_url_rule(u'/<id>/resource_edit/<resource_id>',
                           view_func=LazyView(u'ckan.views.resource.EditView',
                                              str(u'edit_resource')))
コード例 #2
0
ファイル: dataset.py プロジェクト: delyajoseph/ckan-datacode
def register_dataset_plugin_rules(blueprint):
    blueprint.add_url_rule(u'/', view_func=search, strict_slashes=False)
    blueprint.add_url_rule(u'/new', view_func=CreateView.as_view(str(u'new')))
    blueprint.add_url_rule(u'/<id>', view_func=read)
    blueprint.add_url_rule(u'/resources/<id>', view_func=resources)
    blueprint.add_url_rule(u'/edit/<id>',
                           view_func=EditView.as_view(str(u'edit')))
    blueprint.add_url_rule(u'/delete/<id>',
                           view_func=DeleteView.as_view(str(u'delete')))
    blueprint.add_url_rule(u'/follow/<id>',
                           view_func=follow,
                           methods=(u'POST', ))
    blueprint.add_url_rule(u'/unfollow/<id>',
                           view_func=unfollow,
                           methods=(u'POST', ))
    blueprint.add_url_rule(u'/followers/<id>', view_func=followers)
    blueprint.add_url_rule(u'/groups/<id>',
                           view_func=GroupView.as_view(str(u'groups')))
    blueprint.add_url_rule(u'/activity/<id>', view_func=activity)
    blueprint.add_url_rule(u'/changes/<id>', view_func=changes)
    blueprint.add_url_rule(u'/<id>/history', view_func=history)

    blueprint.add_url_rule(u'/changes_multiple', view_func=changes_multiple)

    # Duplicate resource create and edit for backward compatibility. Note,
    # we cannot use resource.CreateView directly here, because of
    # circular imports
    blueprint.add_url_rule(u'/new_resource/<id>',
                           view_func=LazyView(
                               u'ckan.views.resource.CreateView',
                               str(u'new_resource')))

    blueprint.add_url_rule(u'/<id>/resource_edit/<resource_id>',
                           view_func=LazyView(u'ckan.views.resource.EditView',
                                              str(u'edit_resource')))

    if authz.check_config_permission(u'allow_dataset_collaborators'):
        blueprint.add_url_rule(rule=u'/collaborators/<id>',
                               view_func=collaborators_read,
                               methods=[
                                   'GET',
                               ])

        blueprint.add_url_rule(rule=u'/collaborators/<id>/new',
                               view_func=CollaboratorEditView.as_view(
                                   str(u'new_collaborator')),
                               methods=[
                                   u'GET',
                                   u'POST',
                               ])

        blueprint.add_url_rule(rule=u'/collaborators/<id>/delete/<user_id>',
                               view_func=collaborator_delete,
                               methods=[
                                   'POST',
                               ])