1. pjhades
  2. moin-2.0

Commits

Thomas Waldmann  committed 17bc561

deserializer: avoid error condition if limited stream data is not read

  • Participants
  • Parent commits e6eb86a
  • Branches default

Comments (0)

Files changed (1)

File MoinMoin/storage/middleware/serialization.py

View file
         text = meta_str.decode('utf-8')
         meta = json.loads(text)
         data_size = meta[u'size']
-
+        curr_pos = src.tell()
         limited = LimitedStream(src, data_size)
         backend.store(meta, limited)
-        assert limited.is_exhausted
+        if not limited.is_exhausted:
+            # if we already have the DATAID in the backend, the backend code
+            # does not read from the limited stream:
+            assert limited._pos == 0
+            # but we must seek to get forward to the next item:
+            src.seek(curr_pos + data_size)