Remove configurability of the document and document signatures UUID function

This commit is contained in:
Roberto Rosario
2014-11-05 00:18:34 -04:00
parent 11ca9ba1eb
commit 6796ce8b49
5 changed files with 6 additions and 25 deletions
+4 -2
View File
@@ -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__)
-9
View File
@@ -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