Commits

Jean-Tiare Le Bigot committed 49c63a1

clean calling conventions for boto router

  • Participants
  • Parent commits 91c86d2

Comments (0)

Files changed (8)

ddbmock/errors.py

 class InternalServerError(ServerError): pass
 class ServiceUnavailableException(ServerError): pass
 
-def WrapExceptions(func):
+def wrap_exceptions(func):
     def wrapped(*args):
         try:
             return func(*args)

ddbmock/router/botopatch.py

     try:
         target = routes[action]
         mod = import_module('ddbmock.views.{}'.format(target))
-        func = getattr(mod, '_{}'.format(target))
+        func = getattr(mod, target)
         return json.dumps(func(post))
     except KeyError:
         err = InternalFailure("Method: {} does not exist".format(action))

ddbmock/views/create_table.py

 from ddbmock.errors import *
 
 # Real work
-@WrapExceptions
-def _create_table(post):
+@wrap_exceptions
+def create_table(post):
     table = DynamoDB().create_table(post[u'TableName'], post)
 
     if table is None:
     }
 
 # Pyramid route wrapper
-@view_config(route_name='create_table', renderer='json')
-def create_table(request):
-    return _create_table(request.json)
-
+@view_config(route_name='pyramid_create_table', renderer='json')
+def pyramid_create_table(request):
+    return create_table(request.json)

ddbmock/views/delete_table.py

 from ddbmock.errors import *
 
 # Real work
-@WrapExceptions
-def _delete_table(post):
+@wrap_exceptions
+def delete_table(post):
     if u'TableName' not in post:
         raise TypeError("No table name supplied")
 
     }
 
 # Pyramid route wrapper
-@view_config(route_name='delete_table', renderer='json')
-def delete_table(request):
-    return _delete_table(request.json)
+@view_config(route_name='pyramid_delete_table', renderer='json')
+def pyramid_delete_table(request):
+    return delete_table(request.json)

ddbmock/views/describe_table.py

 from ddbmock.errors import *
 
 # Real work
-@WrapExceptions
-def _describe_table(post):
+@wrap_exceptions
+def describe_table(post):
     if u'TableName' not in post:
         raise TypeError("No table name supplied")
 
     }
 
 # Pyramid route wrapper
-@view_config(route_name='describe_table', renderer='json')
-def describe_table(request):
-    return _describe_table(request.json)
+@view_config(route_name='pyramid_describe_table', renderer='json')
+def pyramid_describe_table(request):
+    return describe_table(request.json)

ddbmock/views/list_tables.py

 from ddbmock.errors import *
 
 # Real work
-@WrapExceptions
-def _list_tables(post):
+@wrap_exceptions
+def list_tables(post):
     return {
         'TableNames': DynamoDB().list_tables()
     }
 
 # Pyramid route wrapper
-@view_config(route_name='list_tables', renderer='json')
-def list_tables(request):
-    return _list_tables(request.json)
+@view_config(route_name='pyramid_list_tables', renderer='json')
+def pyramid_list_tables(request):
+    return list_tables(request.json)

ddbmock/views/update_table.py

 from ddbmock.errors import *
 
 # Real work
-@WrapExceptions
-def _update_table(post):
+@wrap_exceptions
+def update_table(post):
     if u'TableName' not in post:
         raise TypeError("No table name supplied")
     if u'ProvisionedThroughput' not in post:
     }
 
 # Pyramid route wrapper
-@view_config(route_name='update_table', renderer='json')
-def update_table(request):
-    return _update_table(request.json)
+@view_config(route_name='pyramid_update_table', renderer='json')
+def pyramid_update_table(request):
+    return update_table(request.json)
 
     'pyramid',
     'waitress',
-    'webtest'
+    'webtest',
+    'voluptuous',
 ]
 
 tests_requires = [
     # d2to1 bootstrap
     'd2to1',
+    'voluptuous',
     'pyramid',
     'boto',