Commits

Ronny Pfannschmidt committed b69c1a7

make file descriptor arguments to serializer more consistent

Comments (0)

Files changed (1)

middleware/serializer.py

 from werkzeug.wsgi import LimitedStream
 
 
-def serialize(backend, targetfile):
-    targetfile.writelines(serialize_iter(backend))
+def serialize(backend, dst):
+    dst.writelines(serialize_iter(backend))
 
 
 def serialize_iter(backend):
     yield struct.pack('!i', 0)
 
 
-def deserialize(io, backend):
+def deserialize(src, backend):
     while True:
-        meta_size_bytes = io.read(4)
+        meta_size_bytes = src.read(4)
         meta_size = struct.unpack('!i', meta_size_bytes)[0]
         if not meta_size:
             return
-        meta_str = io.read(meta_size)
+        meta_str = src.read(meta_size)
         text = meta_str.decode('utf-8')
         meta = json.loads(text)
         data_size = meta[u'size']
 
-        limited = LimitedStream(io, data_size)
+        limited = LimitedStream(src, data_size)
         backend.store_revision(meta, limited)
         assert limited.is_exhausted