Пример #1
0
def api_url_patterns():
    # todo: these have to come first to short-circuit tastypie's matching
    yield url(r'v0.5/odata/Cases/$',
              ODataServiceView.as_view(),
              name='odata_service')
    yield url(r'v0.5/odata/Cases/\$metadata$',
              ODataMetadataView.as_view(),
              name='odata_meta')
    for version, resources in API_LIST:
        api = CommCareHqApi(api_name='v%d.%d' % version)
        for R in resources:
            api.register(R())
        yield url(r'^', include(api.urls))
    # HACK: fix circular import here, to fix later
    try:
        from pact.api import PactAPI
    except ImportError:
        pass  # maybe pact isn't installed
    for view_class in DomainAPI.__subclasses__():
        yield url(r'^custom/%s/v%s/$' %
                  (view_class.api_name(), view_class.api_version()),
                  view_class.as_view(),
                  name="%s_%s" %
                  (view_class.api_name(), view_class.api_version()))
    yield url(r'^case/attachment/(?P<case_id>[\w\-:]+)/(?P<attachment_id>.*)$',
              CaseAttachmentAPI.as_view(),
              name="api_case_attachment")
    yield url(r'^form/attachment/(?P<form_id>[\w\-:]+)/(?P<attachment_id>.*)$',
              FormAttachmentAPI.as_view(),
              name="api_form_attachment")
Пример #2
0
def api_url_patterns():
    for version, resources in API_LIST:
        api = CommCareHqApi(api_name='v%d.%d' % version)
        for R in resources:
            api.register(R())
        yield url(r'^', include(api.urls))
    # HACK: fix circular import here, to fix later
    try:
        from pact.api import PactAPI
    except ImportError:
        pass # maybe pact isn't installed
    for view_class in DomainAPI.__subclasses__():
        yield url(r'^custom/%s/v%s/$' % (view_class.api_name(), view_class.api_version()), view_class.as_view(), name="%s_%s" % (view_class.api_name(), view_class.api_version()))
    yield url(r'^case/attachment/(?P<case_id>[\w\-]+)/(?P<attachment_id>.*)$', CaseAttachmentAPI.as_view(), name="api_case_attachment")
    yield url(r'^form/attachment/(?P<form_id>[\w\-]+)/(?P<attachment_id>.*)$', FormAttachmentAPI.as_view(), name="api_form_attachment")
Пример #3
0
def api_url_patterns():
    # todo: these have to come first to short-circuit tastypie's matching
    yield url(r'v0.5/odata/Cases/$', ODataServiceView.as_view(), name='odata_service')
    yield url(r'v0.5/odata/Cases/\$metadata$', ODataMetadataView.as_view(), name='odata_meta')
    for version, resources in API_LIST:
        api = CommCareHqApi(api_name='v%d.%d' % version)
        for R in resources:
            api.register(R())
        yield url(r'^', include(api.urls))
    # HACK: fix circular import here, to fix later
    try:
        from pact.api import PactAPI
    except ImportError:
        pass # maybe pact isn't installed
    for view_class in DomainAPI.__subclasses__():
        yield url(r'^custom/%s/v%s/$' % (view_class.api_name(), view_class.api_version()), view_class.as_view(), name="%s_%s" % (view_class.api_name(), view_class.api_version()))
    yield url(r'^case/attachment/(?P<case_id>[\w\-:]+)/(?P<attachment_id>.*)$', CaseAttachmentAPI.as_view(), name="api_case_attachment")
    yield url(r'^form/attachment/(?P<form_id>[\w\-:]+)/(?P<attachment_id>.*)$', FormAttachmentAPI.as_view(), name="api_form_attachment")
Пример #4
0
def api_url_patterns():
    # todo: these have to come first to short-circuit tastypie's matching
    yield url(
        r'v0.5/odata/cases/(?P<config_id>[\w\-:]+)/(?P<table_id>[\d]+)/$',
        ODataCaseServiceView.as_view(),
        name=ODataCaseServiceView.table_urlname)
    yield url(r'v0.5/odata/cases/(?P<config_id>[\w\-:]+)/$',
              ODataCaseServiceView.as_view(),
              name=ODataCaseServiceView.urlname)
    yield url(
        r'v0.5/odata/cases/(?P<config_id>[\w\-:]+)/(?P<table_id>[\d]+)/\$metadata$',
        ODataCaseMetadataView.as_view(),
        name=ODataCaseMetadataView.table_urlname)
    yield url(r'v0.5/odata/cases/(?P<config_id>[\w\-:]+)/\$metadata$',
              ODataCaseMetadataView.as_view(),
              name=ODataCaseMetadataView.urlname)

    yield url(
        r'v0.5/odata/forms/(?P<config_id>[\w\-:]+)/(?P<table_id>[\d]+)/$',
        ODataFormServiceView.as_view(),
        name=ODataFormServiceView.table_urlname)
    yield url(r'v0.5/odata/forms/(?P<config_id>[\w\-:]+)/$',
              ODataFormServiceView.as_view(),
              name=ODataFormServiceView.urlname)
    yield url(
        r'v0.5/odata/forms/(?P<config_id>[\w\-:]+)/(?P<table_id>[\d]+)/\$metadata$',
        ODataFormMetadataView.as_view(),
        name=ODataFormMetadataView.table_urlname)
    yield url(r'v0.5/odata/forms/(?P<config_id>[\w\-:]+)/\$metadata$',
              ODataFormMetadataView.as_view(),
              name=ODataFormMetadataView.urlname)
    for version, resources in API_LIST:
        api = CommCareHqApi(api_name='v%d.%d' % version)
        for R in resources:
            api.register(R())
        yield url(r'^', include(api.urls))
    yield url(r'^case/attachment/(?P<case_id>[\w\-:]+)/(?P<attachment_id>.*)$',
              CaseAttachmentAPI.as_view(),
              name="api_case_attachment")
    yield url(r'^form/attachment/(?P<form_id>[\w\-:]+)/(?P<attachment_id>.*)$',
              FormAttachmentAPI.as_view(),
              name="api_form_attachment")
Пример #5
0
def api_url_patterns():
    # todo: these have to come first to short-circuit tastypie's matching
    yield url(
        r'v0.5/odata/cases/(?P<config_id>[\w\-:]+)/(?P<table_id>[\d]+)/$',
        ODataCaseServiceView.as_view(),
        name=ODataCaseServiceView.table_urlname)
    yield url(r'v0.5/odata/cases/(?P<config_id>[\w\-:]+)/$',
              ODataCaseServiceView.as_view(),
              name=ODataCaseServiceView.urlname)
    yield url(
        r'v0.5/odata/cases/(?P<config_id>[\w\-:]+)/(?P<table_id>[\d]+)/\$metadata$',
        ODataCaseMetadataView.as_view(),
        name=ODataCaseMetadataView.table_urlname)
    yield url(r'v0.5/odata/cases/(?P<config_id>[\w\-:]+)/\$metadata$',
              ODataCaseMetadataView.as_view(),
              name=ODataCaseMetadataView.urlname)

    yield url(
        r'v0.5/odata/forms/(?P<config_id>[\w\-:]+)/(?P<table_id>[\d]+)/$',
        ODataFormServiceView.as_view(),
        name=ODataFormServiceView.table_urlname)
    yield url(r'v0.5/odata/forms/(?P<config_id>[\w\-:]+)/$',
              ODataFormServiceView.as_view(),
              name=ODataFormServiceView.urlname)
    yield url(
        r'v0.5/odata/forms/(?P<config_id>[\w\-:]+)/(?P<table_id>[\d]+)/\$metadata$',
        ODataFormMetadataView.as_view(),
        name=ODataFormMetadataView.table_urlname)
    yield url(r'v0.5/odata/forms/(?P<config_id>[\w\-:]+)/\$metadata$',
              ODataFormMetadataView.as_view(),
              name=ODataFormMetadataView.urlname)
    yield url(r'v0.6/case/', include(case_api_urlpatterns))
    yield from versioned_apis(API_LIST)
    yield url(r'^case/attachment/(?P<case_id>[\w\-:]+)/(?P<attachment_id>.*)$',
              CaseAttachmentAPI.as_view(),
              name="api_case_attachment")
    yield url(r'^form/attachment/(?P<form_id>[\w\-:]+)/(?P<attachment_id>.*)$',
              FormAttachmentAPI.as_view(),
              name="api_form_attachment")
Пример #6
0
def api_url_patterns():
    for version, resources in API_LIST:
        api = CommCareHqApi(api_name='v%d.%d' % version)
        for R in resources:
            api.register(R())
        yield (r'^', include(api.urls))
    # HACK: fix circular import here, to fix later
    try:
        from pact.api import PactAPI
    except ImportError:
        pass  # maybe pact isn't installed
    for view_class in DomainAPI.__subclasses__():
        yield url(r'^custom/%s/v%s/$' %
                  (view_class.api_name(), view_class.api_version()),
                  view_class.as_view(),
                  name="%s_%s" %
                  (view_class.api_name(), view_class.api_version()))
    yield url(r'^case/attachment/(?P<case_id>[\w\-]+)/(?P<attachment_id>.*)$',
              CaseAttachmentAPI.as_view(),
              name="api_case_attachment")
    yield url(r'^form/attachment/(?P<form_id>[\w\-]+)/(?P<attachment_id>.*)$',
              FormAttachmentAPI.as_view(),
              name="api_form_attachment")