From: YAMAMOTO Takashi Date: Thu, 2 Jul 2015 08:33:24 +0000 (+0900) Subject: portsecurity_db_common: Access db columns in a consistent way X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=efa1f16706c9d44c654be411e9bf0c1c8f670801;p=openstack-build%2Fneutron-build.git portsecurity_db_common: Access db columns in a consistent way While db columns and api attribute happen to have same name here, it's still better to distinguish them. Change-Id: I6d6e649925a41d89fd74ca5e64290737c9baed9a --- diff --git a/neutron/db/portsecurity_db_common.py b/neutron/db/portsecurity_db_common.py index 3fad11152..e348f81b1 100644 --- a/neutron/db/portsecurity_db_common.py +++ b/neutron/db/portsecurity_db_common.py @@ -83,7 +83,7 @@ class PortSecurityDbCommon(object): NetworkSecurityBinding.network_id == network_id).one() except exc.NoResultFound: raise psec.PortSecurityBindingNotFound() - return binding[psec.PORTSECURITY] + return binding.port_security_enabled def _get_port_security_binding(self, context, port_id): try: @@ -92,7 +92,7 @@ class PortSecurityDbCommon(object): PortSecurityBinding.port_id == port_id).one() except exc.NoResultFound: raise psec.PortSecurityBindingNotFound() - return binding[psec.PORTSECURITY] + return binding.port_security_enabled def _process_port_port_security_update( self, context, port_req, port_res): @@ -130,10 +130,10 @@ class PortSecurityDbCommon(object): def _make_network_port_security_dict(self, port_security, fields=None): res = {'network_id': port_security['network_id'], - psec.PORTSECURITY: port_security[psec.PORTSECURITY]} + psec.PORTSECURITY: port_security.port_security_enabled} return self._fields(res, fields) def _make_port_security_dict(self, port, fields=None): res = {'port_id': port['port_id'], - psec.PORTSECURITY: port[psec.PORTSECURITY]} + psec.PORTSECURITY: port.port_security_enabled} return self._fields(res, fields)