Browse Source

Reset version to 0 for newly created documents "from paste"

master
Eugen Ciur 1 year ago
parent
commit
bea2a7dd62
  1. 4
      changelog.md
  2. 12
      mglib/storage.py
  3. 2
      setup.cfg

4
changelog.md

@ -1,6 +1,10 @@
# Changelog
## [1.3.8] - 4 March 2020
- bug fix: reset version to 0 for newly created documents "from paste"
## [1.3.5] - 14 December 2020
### Changed

12
mglib/storage.py

@ -391,9 +391,17 @@ class Storage:
from src_doc_path. Both dest and src are instances of
mglib.path.DocumentPath
"""
next_version = 0
if dest_doc_is_new:
# document is new, start version with 0
next_version = 0
else:
# destination document is not new, increment its version
next_version = dest_doc_path.version + 1
next_ver_dp = DocumentPath.copy_from(
dest_doc_path,
version=dest_doc_path.version + 1
version=next_version
)
self.make_sure_path_exists(
self.abspath(next_ver_dp)
@ -448,7 +456,7 @@ class Storage:
)
dest_page_num += 1
return dest_doc_path.version + 1
return next_version
class FileSystemStorage(Storage):

2
setup.cfg

@ -1,6 +1,6 @@
[metadata]
name = mglib
version = 1.3.7
version = 1.3.8
description = Common code used across all Papermerge project utilities
long_description = file: README.rst
url = https://www.papermerge.com/

Loading…
Cancel
Save