Пример #1
0
 def decorator(func):
     def service_wrapper(self, request, *args, **kwargs):
         if request.method not in methods:
             raise MethodNotAllowed(methods)
         ret = func(self, request, *args, **kwargs)
         return send_service_response(request, ret, config)
     service_wrapper.endpoint = name
     service_wrapper.is_service = True
     service_wrapper.valid_methods = methods
     return update_wrapper(service_wrapper, func)
Пример #2
0
def test_update_wrapper():
    def proxy(func):
        return func

    def func(foo='bar'):
        """doc"""
        print foo

    new = update_wrapper(proxy, func)
    assert_equals(new.signature, (['foo'], None, None, ('bar',)))
    assert_equals(new.__doc__, 'doc')
Пример #3
0
def test_update_wrapper():
    def proxy(func):
        return func

    def func(foo="bar"):
        """doc"""
        print foo

    new = update_wrapper(proxy, func)
    assert_equals(new.signature, (["foo"], None, None, ("bar",)))
    assert_equals(new.__doc__, "doc")