Michael Pasternak has uploaded a new change for review.

Change subject: sdk: encapsulate context removal
......................................................................

sdk: encapsulate context removal

this patch encapsulate context removal and among
removing cache content, removes the cache instance
as well

Change-Id: I5a4560c17f7d0123e5cc6c33a1b2fc393849e302
Signed-off-by: Michael pasternak <mpast...@redhat.com>
---
M src/codegen/templates/entrypointmethodstemplate
M src/ovirtsdk/api.py
M src/ovirtsdk/infrastructure/contextmanager.py
3 files changed, 14 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-sdk refs/changes/66/18066/1

diff --git a/src/codegen/templates/entrypointmethodstemplate 
b/src/codegen/templates/entrypointmethodstemplate
index 636a8c6..f84988b 100644
--- a/src/codegen/templates/entrypointmethodstemplate
+++ b/src/codegen/templates/entrypointmethodstemplate
@@ -33,7 +33,7 @@
             raise DisconnectedError
 
         # Clear context
-        context.manager[self.id].clear(force=True)
+        context.manager.drop(self.id)
 
     def test(self, throw_exception=False):
         ''' test server connectivity '''
diff --git a/src/ovirtsdk/api.py b/src/ovirtsdk/api.py
index 84cc8b2..f17da65 100644
--- a/src/ovirtsdk/api.py
+++ b/src/ovirtsdk/api.py
@@ -20,7 +20,7 @@
 ############ GENERATED CODE ############
 ########################################
 
-'''Generated at: 2013-08-14 10:30:29.498191'''
+'''Generated at: 2013-08-14 12:10:31.267414'''
 
 import types
 
@@ -209,7 +209,7 @@
             raise DisconnectedError
 
         # Clear context
-        context.manager[self.id].clear(force=True)
+        context.manager.drop(self.id)
 
     def test(self, throw_exception=False):
         ''' test server connectivity '''
diff --git a/src/ovirtsdk/infrastructure/contextmanager.py 
b/src/ovirtsdk/infrastructure/contextmanager.py
index 715eb2a..915ae3f 100644
--- a/src/ovirtsdk/infrastructure/contextmanager.py
+++ b/src/ovirtsdk/infrastructure/contextmanager.py
@@ -28,6 +28,16 @@
 
     def __getitem__(self, key):
         with self.__lock:
-            if key not in self.keys():
+            if key not in self.data.keys():
                 OrderedDict.__setitem__(self, key, Cache())
         return OrderedDict.__getitem__(self, key)
+
+    def drop(self, key):
+        """
+        Removes specified context
+        
+        @param key: the context id
+        """
+        item = self.__getitem__(key)
+        item.clear(force=True)        
+        self.pop(key)
\ No newline at end of file


-- 
To view, visit http://gerrit.ovirt.org/18066
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a4560c17f7d0123e5cc6c33a1b2fc393849e302
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-sdk
Gerrit-Branch: master
Gerrit-Owner: Michael Pasternak <mpast...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to