Add .delete() to all Storages.
Reviewed in http://codereview.appspot.com/5608049/.
diff --git a/oauth2client/client.py b/oauth2client/client.py
index 2d60f5a..f492563 100644
--- a/oauth2client/client.py
+++ b/oauth2client/client.py
@@ -224,6 +224,13 @@
"""
_abstract()
+ def locked_delete(self):
+ """Delete a credential.
+
+ The Storage lock must be held when this is called.
+ """
+ _abstract()
+
def get(self):
"""Retrieve credential.
@@ -252,6 +259,21 @@
finally:
self.release_lock()
+ def delete(self):
+ """Delete credential.
+
+ Frees any resources associated with storing the credential.
+ The Storage lock must *not* be held when this is called.
+
+ Returns:
+ None
+ """
+ self.acquire_lock()
+ try:
+ return self.locked_delete()
+ finally:
+ self.release_lock()
+
class OAuth2Credentials(Credentials):
"""Credentials object for OAuth 2.0.