mirror of https://github.com/papermerge/mglib
Reset version to 0 for newly created documents "from paste"
parent
e27107ae83
commit
bea2a7dd62
|
@ -1,6 +1,10 @@
|
||||||
|
|
||||||
# Changelog
|
# 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
|
## [1.3.5] - 14 December 2020
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
@ -391,9 +391,17 @@ class Storage:
|
||||||
from src_doc_path. Both dest and src are instances of
|
from src_doc_path. Both dest and src are instances of
|
||||||
mglib.path.DocumentPath
|
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(
|
next_ver_dp = DocumentPath.copy_from(
|
||||||
dest_doc_path,
|
dest_doc_path,
|
||||||
version=dest_doc_path.version + 1
|
version=next_version
|
||||||
)
|
)
|
||||||
self.make_sure_path_exists(
|
self.make_sure_path_exists(
|
||||||
self.abspath(next_ver_dp)
|
self.abspath(next_ver_dp)
|
||||||
|
@ -448,7 +456,7 @@ class Storage:
|
||||||
)
|
)
|
||||||
dest_page_num += 1
|
dest_page_num += 1
|
||||||
|
|
||||||
return dest_doc_path.version + 1
|
return next_version
|
||||||
|
|
||||||
|
|
||||||
class FileSystemStorage(Storage):
|
class FileSystemStorage(Storage):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[metadata]
|
[metadata]
|
||||||
name = mglib
|
name = mglib
|
||||||
version = 1.3.7
|
version = 1.3.8
|
||||||
description = Common code used across all Papermerge project utilities
|
description = Common code used across all Papermerge project utilities
|
||||||
long_description = file: README.rst
|
long_description = file: README.rst
|
||||||
url = https://www.papermerge.com/
|
url = https://www.papermerge.com/
|
||||||
|
|
Loading…
Reference in New Issue