Permalink
Browse files

Rename layer2 to wrapper

The existing layer2 class wraps the layer1
response and returns classes instead of dict
responses.  There is potential for a high level
interface to beanstalk, which, to be consistent
with other services, would be layer2.
  • Loading branch information...
1 parent adfe953 commit a4fe5f3216b78328f80247b56a70003971e9ce7d @jamesls jamesls committed Sep 4, 2012
@@ -1,3 +0,0 @@
-from boto.beanstalk.layer2 import Layer2
-
-class Beanstalk(Layer2): pass
@@ -1,6 +1,4 @@
-#
-# wraps layer1 api methods in order to convert layer1 dict responses to response objects
-#
+"""Wraps layer1 api methods and converts layer1 dict responses to objects."""
from boto.beanstalk.layer1 import Layer1
import boto.beanstalk.response
from boto.exception import BotoServerError
@@ -13,16 +11,14 @@ def _wrapped_low_level_api(*args, **kwargs):
response = func(*args, **kwargs)
except BotoServerError, e:
raise exception.simple(e)
- # turn 'this_is_a_function_name' into 'ThisIsAFunctionNameResponse'
+ # Turn 'this_is_a_function_name' into 'ThisIsAFunctionNameResponse'.
cls_name = ''.join([part.capitalize() for part in name.split('_')]) + 'Response'
cls = getattr(boto.beanstalk.response, cls_name)
-
- # return class instead
return cls(response)
return _wrapped_low_level_api
-class Layer2(object):
+class Layer1Wrapper(object):
def __init__(self, *args, **kwargs):
self.api = Layer1(*args, **kwargs)
@@ -3,7 +3,7 @@
import time
from functools import partial
-from boto.beanstalk.layer2 import Layer2
+from boto.beanstalk.wrapper import Layer1Wrapper
import boto.beanstalk.response as response
@@ -14,7 +14,7 @@ def setUp(self):
self.app_version = 'version-' + self.random_id
self.template = 'template-' + self.random_id
self.environment = 'environment-' + self.random_id
- self.beanstalk = Layer2()
+ self.beanstalk = Layer1Wrapper()
class MiscSuite(BasicSuite):
@@ -129,7 +129,7 @@ def setUpClass(cls):
cls.environment = 'environment-' + cls.random_id
cls.template = 'template-' + cls.random_id
- cls.beanstalk = Layer2()
+ cls.beanstalk = Layer1Wrapper()
cls.beanstalk.create_application(application_name=cls.app_name)
cls.beanstalk.create_configuration_template(
application_name=cls.app_name, template_name=cls.template,

0 comments on commit a4fe5f3

Please sign in to comment.