Update document indexing app setting to use registry file and create literals for default values
This commit is contained in:
@@ -1 +0,0 @@
|
||||
|
||||
2
apps/document_indexing/literals.py
Normal file
2
apps/document_indexing/literals.py
Normal file
@@ -0,0 +1,2 @@
|
||||
DEFAULT_SUFFIX_SEPARATOR = u'_'
|
||||
DEFAULT_MAX_SUFFIX_COUNT = 1000
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user