예제 #1
0
파일: flask.py 프로젝트: tvboxme/resource
def add_resource(app, resource, pk='pk'):
    uri, endpoint, view_func = get_args(resource)

    app.add_url_rule(normalize_uri(uri), view_func=view_func,
                     methods=['OPTIONS', 'GET', 'POST', 'DELETE'])
    app.add_url_rule(normalize_uri('%s/<%s>' % (uri, pk)), view_func=view_func,
                     methods=['OPTIONS', 'GET', 'PUT', 'PATCH', 'DELETE'])
예제 #2
0
def add_resource(resource, pk='pk'):
    uri, _, view_cls = get_args(resource)
    urlpatterns = patterns('',
        url_rule(r'^%s$' % normalize_uri(uri), view_cls,
                 methods=['OPTIONS', 'GET', 'POST', 'DELETE']),
        url_rule(r'^%s$' % normalize_uri('%s/(?P<pk>\w+)' % uri), view_cls,
                 methods=['OPTIONS', 'GET', 'PUT', 'PATCH', 'DELETE'])
    )
    return urlpatterns
예제 #3
0
def add_resource(resource, pk='pk'):
    uri, _, view_cls = get_args(resource)
    urlpatterns = patterns('',
        url_rule(r'^%s$' % normalize_uri(uri), view_cls,
                 methods=['OPTIONS', 'GET', 'POST', 'DELETE']),
        url_rule(r'^%s$' % normalize_uri('%s/(?P<pk>\w+)' % uri), view_cls,
                 methods=['OPTIONS', 'GET', 'PUT', 'PATCH', 'DELETE'])
    )
    return urlpatterns
예제 #4
0
파일: root.py 프로젝트: lampard1010/mock
 def __init__(self, *arg, **kwargs):
     super(Root, self).__init__(*arg, **kwargs)
     self.links = [
         {
             'href': normalize_uri(settings.DOMAIN_NAME + r.uri),
             'title': r.name
         }
         for r in self.resources
     ]
예제 #5
0
파일: django.py 프로젝트: lampard1010/mock
def make_root(resource, pk='pk'):
    uri, _, view_cls = get_args(resource)
    urlpatterns = patterns(
        '', url_rule(r'^%s$' % normalize_uri(uri), view_cls, methods=['GET']))
    return urlpatterns
예제 #6
0
파일: flask.py 프로젝트: lampard1010/mock
def make_root(app, resource, pk='pk'):
    uri, endpoint, view_func = get_args(resource)

    app.add_url_rule(normalize_uri(uri), view_func=view_func, methods=['GET'])
예제 #7
0
def make_root(resource, pk='pk'):
    uri, _, view_cls = get_args(resource)
    urlpatterns = patterns('',
        url_rule(r'^%s$' % normalize_uri(uri), view_cls, methods=['GET'])
    )
    return urlpatterns