Remove legacy support for pickled Credentials.
Reviewed in http://codereview.appspot.com/5323055/.
diff --git a/oauth2client/appengine.py b/oauth2client/appengine.py
index 3f2b727..1bc2aaa 100644
--- a/oauth2client/appengine.py
+++ b/oauth2client/appengine.py
@@ -75,7 +75,6 @@
a two legged flow, and therefore has all of the required information to
generate and refresh its own access tokens.
- AssertionFlowCredentials objects may be safely pickled and unpickled.
"""
def __init__(self, scope,
@@ -197,14 +196,10 @@
return None
if len(value) == 0:
return None
- credentials = None
try:
credentials = Credentials.new_from_json(value)
except ValueError:
- try:
- credentials = pickle.loads(value)
- except ValueError:
- credentials = None
+ credentials = None
return credentials
def validate(self, value):
diff --git a/oauth2client/file.py b/oauth2client/file.py
index 60a6385..34a5f48 100644
--- a/oauth2client/file.py
+++ b/oauth2client/file.py
@@ -20,7 +20,6 @@
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
-import pickle
import threading
@@ -74,18 +73,11 @@
except IOError:
return credentials
- # First try reading as JSON, and if that fails fall back to pickle.
try:
credentials = Credentials.new_from_json(content)
credentials.set_store(self)
except ValueError:
- # TODO(jcgregorio) On a future release remove this path to finally remove
- # all pickle support.
- try:
- credentials = pickle.loads(content)
- credentials.set_store(self)
- except:
- pass
+ pass
return credentials
diff --git a/oauth2client/multistore_file.py b/oauth2client/multistore_file.py
index 02e36d1..cf43dd9 100644
--- a/oauth2client/multistore_file.py
+++ b/oauth2client/multistore_file.py
@@ -35,7 +35,6 @@
import fcntl
import logging
import os
-import pickle
import threading
try: # pragma: no cover
diff --git a/tests/test_oauth2client_file.py b/tests/test_oauth2client_file.py
index de5fcf2..2d6f3b5 100644
--- a/tests/test_oauth2client_file.py
+++ b/tests/test_oauth2client_file.py
@@ -91,12 +91,11 @@
pickle.dump(credentials, f)
f.close()
- # Storage should be able to read that object.
- # TODO(jcgregorio) This should fail once pickle support is removed.
+ # Storage should be not be able to read that object, as the capability to
+ # read and write credentials as pickled objects has been removed.
s = Storage(FILENAME)
- credentials = s.get()
- self.assertNotEquals(None, credentials)
- self.assertEquals('foo', credentials.access_token)
+ read_credentials = s.get()
+ self.assertEquals(None, read_credentials)
# Now write it back out and confirm it has been rewritten as JSON
s.put(credentials)