Style: Move document model functions

Move the document UUID and document hash functions
to the documents.utils module.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2018-12-07 18:08:47 -04:00
parent 255b1c75ea
commit 50e72fdb4e
5 changed files with 19 additions and 16 deletions
+12
View File
@@ -1,6 +1,10 @@
from __future__ import unicode_literals
import hashlib
import uuid
from django.apps import apps
from django.utils.encoding import force_text
from .literals import DOCUMENT_IMAGES_CACHE_NAME
@@ -12,6 +16,14 @@ def callback_update_cache_size(setting):
cache.save()
def document_hash_function(data):
return hashlib.sha256(data).hexdigest()
def document_uuid_function(*args, **kwargs):
return force_text(uuid.uuid4())
def parse_range(astr):
# http://stackoverflow.com/questions/4248399/
# page-range-for-printing-algorithm