From 4ea658a1b968b98d3bc93f117615f0f3ea3f5bc9 Mon Sep 17 00:00:00 2001 From: Eugen Ciur Date: Sun, 17 May 2020 14:16:29 +0200 Subject: [PATCH] yee! refactoring works! --- mglib/storage.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mglib/storage.py b/mglib/storage.py index 7f9367e..b23f297 100644 --- a/mglib/storage.py +++ b/mglib/storage.py @@ -334,6 +334,19 @@ class Storage: before_page_number=before_page_number ) + if not dest_doc_is_new: + # migrate document's own pages from previous + # version (this differs from pasting into newly + # created docs) + pcount = self.get_pagecount(dest_doc_path) + data_list.insert( + 0, + { + 'doc_path': dest_doc_path, + 'page_nums': list(range(1, pcount + 1)) + } + ) + dest_page_num = 1 dest_page_count = sum([ len(item['page_nums']) for item in data_list