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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user