mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 01:03:24 +00:00
Make Serializers Dumber
Let's have the serializer just worry about serializing the dict that we hand it, and move the unicode stuff up to a serialize module. This should hopefully let us move toward using a version string in cassettes.
This commit is contained in:
@@ -2,6 +2,7 @@ import tempfile
|
||||
|
||||
from .persisters.filesystem import FilesystemPersister
|
||||
from . import migration
|
||||
from . import serialize
|
||||
|
||||
|
||||
def _check_for_old_cassette(cassette_content):
|
||||
@@ -21,7 +22,7 @@ def load_cassette(cassette_path, serializer):
|
||||
with open(cassette_path) as f:
|
||||
cassette_content = f.read()
|
||||
try:
|
||||
cassette = serializer.deserialize(cassette_content)
|
||||
cassette = serialize.deserialize(cassette_content, serializer)
|
||||
except TypeError:
|
||||
_check_for_old_cassette(cassette_content)
|
||||
raise
|
||||
@@ -29,5 +30,5 @@ def load_cassette(cassette_path, serializer):
|
||||
|
||||
|
||||
def save_cassette(cassette_path, cassette_dict, serializer):
|
||||
data = serializer.serialize(cassette_dict)
|
||||
data = serialize.serialize(cassette_dict, serializer)
|
||||
FilesystemPersister.write(cassette_path, data)
|
||||
|
||||
Reference in New Issue
Block a user