Merge "Don't inherit controllers from each other, we don't want the methods of our parent"

This commit is contained in:
Jenkins 2012-02-21 17:16:01 +00:00 committed by Gerrit Code Review
commit 0774865a2f

View File

@ -174,12 +174,11 @@ class SecurityGroupRulesXMLDeserializer(wsgi.MetadataXMLDeserializer):
return sg_rule return sg_rule
class SecurityGroupController(object): class SecurityGroupControllerBase(object):
"""The Security group API controller for the OpenStack API.""" """Base class for Security Group controllers."""
def __init__(self): def __init__(self):
self.compute_api = compute.API() self.compute_api = compute.API()
super(SecurityGroupController, self).__init__()
self.sgh = utils.import_object(FLAGS.security_group_handler) self.sgh = utils.import_object(FLAGS.security_group_handler)
def _format_security_group_rule(self, context, rule): def _format_security_group_rule(self, context, rule):
@ -211,6 +210,10 @@ class SecurityGroupController(object):
context, rule)] context, rule)]
return security_group return security_group
class SecurityGroupController(SecurityGroupControllerBase):
"""The Security group API controller for the OpenStack API."""
def _get_security_group(self, context, id): def _get_security_group(self, context, id):
try: try:
id = int(id) id = int(id)
@ -317,7 +320,7 @@ class SecurityGroupController(object):
raise exc.HTTPBadRequest(explanation=msg) raise exc.HTTPBadRequest(explanation=msg)
class SecurityGroupRulesController(SecurityGroupController): class SecurityGroupRulesController(SecurityGroupControllerBase):
@wsgi.serializers(xml=SecurityGroupRuleTemplate) @wsgi.serializers(xml=SecurityGroupRuleTemplate)
@wsgi.deserializers(xml=SecurityGroupRulesXMLDeserializer) @wsgi.deserializers(xml=SecurityGroupRulesXMLDeserializer)
@ -509,12 +512,7 @@ class SecurityGroupRulesController(SecurityGroupController):
return webob.Response(status_int=202) return webob.Response(status_int=202)
# NOTE(justinsb): Does WSGI see the base class methods? class ServerSecurityGroupController(SecurityGroupControllerBase):
# i.e. are we exposing create/delete here?
class ServerSecurityGroupController(SecurityGroupController):
def __init__(self, *args, **kwargs):
super(ServerSecurityGroupController, self).__init__(*args, **kwargs)
self.compute_api = compute.API()
@wsgi.serializers(xml=SecurityGroupsTemplate) @wsgi.serializers(xml=SecurityGroupsTemplate)
def index(self, req, server_id): def index(self, req, server_id):