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

View File

@@ -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.

View File

@@ -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**

View File

@@ -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__)

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__)

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