diff options
author | Zhongyue Luo <zhongyue.nah@intel.com> | 2013-01-31 14:24:29 +0800 |
---|---|---|
committer | Zhongyue Luo <zhongyue.nah@intel.com> | 2013-01-31 15:00:02 +0800 |
commit | ea46d462fcfd7d393b71b14206a5e6d86bf1994b (patch) | |
tree | e6d2b6b510ae059a53df36c8dff667a435eb95eb | |
parent | c29263c4a81d2e71a3d6e36eb32e5df9d2c8fb05 (diff) | |
download | oslo-ea46d462fcfd7d393b71b14206a5e6d86bf1994b.tar.gz oslo-ea46d462fcfd7d393b71b14206a5e6d86bf1994b.tar.xz oslo-ea46d462fcfd7d393b71b14206a5e6d86bf1994b.zip |
Fixes 'not in' operator usage
Change-Id: Ibac9853fc72e2452fa5e2b3a493bd03523faabfb
-rw-r--r-- | HACKING.rst | 12 | ||||
-rw-r--r-- | openstack/common/rpc/common.py | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/HACKING.rst b/HACKING.rst index 7dda11a..3f6a3ed 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -27,6 +27,18 @@ General mylist = Foo().list() # OKAY, does not shadow built-in +- Use the "not in" operator for collection membership evaluation. Example:: + + if not X in Y: # BAD, hard to understand + pass + + if X not in Y: # OKAY, intuitive + pass + + if not (X in Y or X is Z): # OKAY, still better than all those 'not's + pass + + TODO vs FIXME ------------- diff --git a/openstack/common/rpc/common.py b/openstack/common/rpc/common.py index 8af2f03..357ee9d 100644 --- a/openstack/common/rpc/common.py +++ b/openstack/common/rpc/common.py @@ -289,7 +289,7 @@ def deserialize_remote_exception(conf, data): # NOTE(ameade): We DO NOT want to allow just any module to be imported, in # order to prevent arbitrary code execution. - if not module in conf.allowed_rpc_exception_modules: + if module not in conf.allowed_rpc_exception_modules: return RemoteError(name, failure.get('message'), trace) try: |