Ronny Pfannschmidt avatar 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
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.