From 6796ce8b495953dfb0b2d7a26f2f1359a3ab9de5 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Wed, 5 Nov 2014 00:18:34 -0400 Subject: [PATCH] Remove configurability of the document and document signatures UUID function --- docs/topics/features.rst | 4 ---- docs/topics/settings.rst | 9 --------- mayan/apps/document_signatures/models.py | 3 ++- mayan/apps/documents/models.py | 6 ++++-- mayan/apps/documents/settings.py | 9 --------- 5 files changed, 6 insertions(+), 25 deletions(-) diff --git a/docs/topics/features.rst b/docs/topics/features.rst index 71cd8c5d4f..91df08e290 100644 --- a/docs/topics/features.rst +++ b/docs/topics/features.rst @@ -32,10 +32,6 @@ Features * If enabled, the document database index can be mirrored in the filesystem of the host and shared via Samba_ or any other sharing method to client computers on a network. -* User defined document unique identifier algorithms. - - * Users can alter the default method used to uniquely indentify documents. - * Documents can be uploaded from different sources. * Local file or server side file uploads, multifunctional copier, or even via email. diff --git a/docs/topics/settings.rst b/docs/topics/settings.rst index 57cf207c1a..073b676a33 100644 --- a/docs/topics/settings.rst +++ b/docs/topics/settings.rst @@ -8,15 +8,6 @@ different server configurations. Documents ========= -.. setting:: DOCUMENTS_UUID_FUNCTION - -**DOCUMENTS_UUID_FUNCTION** - -Default: ``unicode(uuid.uuid4())`` - -The function that will be used to internally identify each uploaded document. - - .. setting:: DOCUMENTS_STORAGE_BACKEND **DOCUMENTS_STORAGE_BACKEND** diff --git a/mayan/apps/document_signatures/models.py b/mayan/apps/document_signatures/models.py index a1a1933923..4e584b381c 100644 --- a/mayan/apps/document_signatures/models.py +++ b/mayan/apps/document_signatures/models.py @@ -1,5 +1,6 @@ from __future__ import absolute_import import logging +import uuid from django.db import models from django.utils.translation import ugettext_lazy as _ @@ -7,10 +8,10 @@ from django.utils.translation import ugettext_lazy as _ from django_gpg.runtime import gpg from documents.models import DocumentVersion from documents.runtime import storage_backend -from documents.settings import UUID_FUNCTION from .managers import DocumentVersionSignatureManager +UUID_FUNCTION = lambda x: unicode(uuid.uuid4()) logger = logging.getLogger(__name__) diff --git a/mayan/apps/documents/models.py b/mayan/apps/documents/models.py index cff73ca208..197b68b382 100644 --- a/mayan/apps/documents/models.py +++ b/mayan/apps/documents/models.py @@ -6,6 +6,7 @@ import hashlib import logging import os import tempfile +import uuid try: from cStringIO import StringIO @@ -35,11 +36,12 @@ from .literals import (LANGUAGE_CHOICES, VERSION_UPDATE_MAJOR, from .managers import (DocumentManager, DocumentPageTransformationManager, DocumentTypeManager, RecentDocumentManager) from .runtime import storage_backend -from .settings import (CACHE_PATH, DISPLAY_SIZE, LANGUAGE, UUID_FUNCTION, - ZOOM_MAX_LEVEL, ZOOM_MIN_LEVEL) +from .settings import (CACHE_PATH, DISPLAY_SIZE, LANGUAGE, ZOOM_MAX_LEVEL, + ZOOM_MIN_LEVEL) from .signals import post_version_upload, post_document_type_change HASH_FUNCTION = lambda x: hashlib.sha256(x).hexdigest() # document image cache name hash function +UUID_FUNCTION = lambda x: unicode(uuid.uuid4()) logger = logging.getLogger(__name__) diff --git a/mayan/apps/documents/settings.py b/mayan/apps/documents/settings.py index 9a3bd67345..9cfed38acc 100644 --- a/mayan/apps/documents/settings.py +++ b/mayan/apps/documents/settings.py @@ -1,25 +1,16 @@ """Configuration options for the documents app""" import os -import uuid from django.conf import settings from django.utils.translation import ugettext_lazy as _ from smart_settings.api import register_settings - -def default_uuid(): - """unicode(uuid.uuid4())""" - return unicode(uuid.uuid4()) - - register_settings( namespace=u'documents', module=u'documents.settings', settings=[ - # Saving - {'name': u'UUID_FUNCTION', 'global_name': u'DOCUMENTS_UUID_FUNCTION', 'default': default_uuid}, # Storage {'name': u'STORAGE_BACKEND', 'global_name': u'DOCUMENTS_STORAGE_BACKEND', 'default': 'storage.backends.filebasedstorage.FileBasedStorage'}, # Usage