diff options
| author | Lance Bragstad <ldbragst@us.ibm.com> | 2013-06-28 02:53:24 +0000 |
|---|---|---|
| committer | Lance Bragstad <ldbragst@us.ibm.com> | 2013-08-01 20:18:58 +0000 |
| commit | cb2a2b6e234be9cb5a63409b5c7594cf6ac4a9d0 (patch) | |
| tree | 7ad353a1f191d57c1125b4e89d952772cf1c8d38 /openstack/common | |
| parent | d4d81262ff74ff54e51db4065192fd9a0119ec34 (diff) | |
| download | oslo-cb2a2b6e234be9cb5a63409b5c7594cf6ac4a9d0.tar.gz oslo-cb2a2b6e234be9cb5a63409b5c7594cf6ac4a9d0.tar.xz oslo-cb2a2b6e234be9cb5a63409b5c7594cf6ac4a9d0.zip | |
Modify local.py to not be dependent on Eventlet
Change local.py to use threading.local instead of being dependent on
Eventlet corolocal.local.
Change-Id: Ib544be1485823f6c619312fdee5a04031f48bbb4
Diffstat (limited to 'openstack/common')
| -rw-r--r-- | openstack/common/local.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/openstack/common/local.py b/openstack/common/local.py index f1bfc82..e82f17d 100644 --- a/openstack/common/local.py +++ b/openstack/common/local.py @@ -15,16 +15,15 @@ # License for the specific language governing permissions and limitations # under the License. -"""Greenthread local storage of variables using weak references""" +"""Local storage of variables using weak references""" +import threading import weakref -from eventlet import corolocal - -class WeakLocal(corolocal.local): +class WeakLocal(threading.local): def __getattribute__(self, attr): - rval = corolocal.local.__getattribute__(self, attr) + rval = super(WeakLocal, self).__getattribute__(attr) if rval: # NOTE(mikal): this bit is confusing. What is stored is a weak # reference, not the value itself. We therefore need to lookup @@ -34,7 +33,7 @@ class WeakLocal(corolocal.local): def __setattr__(self, attr, value): value = weakref.ref(value) - return corolocal.local.__setattr__(self, attr, value) + return super(WeakLocal, self).__setattr__(attr, value) # NOTE(mikal): the name "store" should be deprecated in the future @@ -45,4 +44,4 @@ store = WeakLocal() # "strong" store will hold a reference to the object so that it never falls out # of scope. weak_store = WeakLocal() -strong_store = corolocal.local +strong_store = threading.local() |
