diff --git a/apps/document_indexing/conf/__init__.py b/apps/document_indexing/conf/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/apps/document_indexing/conf/settings.py b/apps/document_indexing/conf/settings.py deleted file mode 100644 index 8b13789179..0000000000 --- a/apps/document_indexing/conf/settings.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/apps/document_indexing/literals.py b/apps/document_indexing/literals.py new file mode 100644 index 0000000000..abff00df8b --- /dev/null +++ b/apps/document_indexing/literals.py @@ -0,0 +1,2 @@ +DEFAULT_SUFFIX_SEPARATOR = u'_' +DEFAULT_MAX_SUFFIX_COUNT = 1000 diff --git a/apps/document_indexing/registry.py b/apps/document_indexing/registry.py index 6176df34b2..5d91c923d7 100644 --- a/apps/document_indexing/registry.py +++ b/apps/document_indexing/registry.py @@ -2,8 +2,16 @@ from __future__ import absolute_import from django.utils.translation import ugettext_lazy as _ +from common.utils import proper_name +from smart_settings import + from .icons import icon_index_setup from .links import index_setup, link_menu +from .literals import DEFAULT_SUFFIX_SEPARATOR, DEFAULT_MAX_SUFFIX_COUNT + +available_indexing_functions = { + 'proper_name': proper_name +} label = _(u'Document indexing') description = _(u'Handles organization indexing for documents.') @@ -13,43 +21,42 @@ setup_links = [index_setup] menu_links = [link_menu] bootstrap_models = ['index', 'indextemplatenode'] +settings = [ + { + 'name': 'AVAILABLE_INDEXING_FUNCTIONS', + 'default': available_indexing_functions, + 'scopes': [LocalScope()], + }, + { + 'name': 'SUFFIX_SEPARATOR', + 'default': DEFAULT_SUFFIX_SEPARATOR, + 'scopes': [LocalScope()], + }, + { + 'name': 'SLUGIFY_PATHS', + 'default': False, + 'scopes': [LocalScope()], + }, + { + 'name': 'MAX_SUFFIX_COUNT', + 'default': DEFAULT_MAX_SUFFIX_COUNT, + 'scopes': [LocalScope()], + }, + { + 'name': 'FILESYSTEM_SERVING', + 'default': {}, + 'description': _(u'A dictionary that maps the index name and where on the filesystem that index will be mirrored.'), + 'scopes': [LocalScope()], + }, +] """ -from django.utils.translation import ugettext_lazy as _ - -from common.utils import proper_name -from smart_settings.api import Setting, SettingNamespace - -available_indexing_functions = { - 'proper_name': proper_name -} - -namespace = SettingNamespace('document_indexing', _(u'Indexing'), module='document_indexing.conf.settings', sprite='tab') - # Definition -Setting( - namespace=namespace, - name='AVAILABLE_INDEXING_FUNCTIONS', - global_name='DOCUMENT_INDEXING_AVAILABLE_INDEXING_FUNCTIONS', - default=available_indexing_functions, -) -Setting( - namespace=namespace, - name='SUFFIX_SEPARATOR', - global_name='DOCUMENT_INDEXING_SUFFIX_SEPARATOR', - default=u'_', -) # Filesystem serving -Setting( - namespace=namespace, - name='SLUGIFY_PATHS', - global_name='DOCUMENT_INDEXING_FILESYSTEM_SLUGIFY_PATHS', - default=False, -) Setting( namespace=namespace,