Merge os_specify and filesystem module
This commit is contained in:
@@ -15,8 +15,8 @@ from .conf.settings import (AVAILABLE_INDEXING_FUNCTIONS,
|
|||||||
MAX_SUFFIX_COUNT, SLUGIFY_PATHS)
|
MAX_SUFFIX_COUNT, SLUGIFY_PATHS)
|
||||||
from .filesystem import (fs_create_index_directory,
|
from .filesystem import (fs_create_index_directory,
|
||||||
fs_create_document_link, fs_delete_document_link,
|
fs_create_document_link, fs_delete_document_link,
|
||||||
fs_delete_index_directory, fs_delete_directory_recusive)
|
fs_delete_index_directory, fs_delete_directory_recusive,
|
||||||
from .os_specifics import assemble_suffixed_filename
|
assemble_suffixed_filename)
|
||||||
|
|
||||||
if SLUGIFY_PATHS == False:
|
if SLUGIFY_PATHS == False:
|
||||||
# Do not slugify path or filenames and extensions
|
# Do not slugify path or filenames and extensions
|
||||||
|
|||||||
@@ -8,6 +8,24 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
from .os_specifics import (assemble_suffixed_filename,
|
from .os_specifics import (assemble_suffixed_filename,
|
||||||
assemble_path_from_list)
|
assemble_path_from_list)
|
||||||
from .conf.settings import (FILESERVING_ENABLE, FILESERVING_PATH)
|
from .conf.settings import (FILESERVING_ENABLE, FILESERVING_PATH)
|
||||||
|
from .conf.settings import SUFFIX_SEPARATOR
|
||||||
|
|
||||||
|
|
||||||
|
def assemble_suffixed_filename(filename, suffix=0):
|
||||||
|
"""
|
||||||
|
Split document filename, to attach suffix to the name part then
|
||||||
|
re attacht the extension
|
||||||
|
"""
|
||||||
|
|
||||||
|
if suffix:
|
||||||
|
name, extension = os.path.splitext(filename)
|
||||||
|
return SUFFIX_SEPARATOR.join([name, unicode(suffix), os.extsep, extension])
|
||||||
|
else:
|
||||||
|
return filename
|
||||||
|
|
||||||
|
|
||||||
|
def assemble_path_from_list(directory_list):
|
||||||
|
return os.sep.join(directory_list)
|
||||||
|
|
||||||
|
|
||||||
def get_instance_path(index_instance):
|
def get_instance_path(index_instance):
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
from __future__ import absolute_import
|
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
from .conf.settings import SUFFIX_SEPARATOR
|
|
||||||
|
|
||||||
|
|
||||||
def assemble_suffixed_filename(filename, suffix=0):
|
|
||||||
"""
|
|
||||||
Split document filename, to attach suffix to the name part then
|
|
||||||
re attacht the extension
|
|
||||||
"""
|
|
||||||
|
|
||||||
if suffix:
|
|
||||||
name, extension = os.path.splitext(filename)
|
|
||||||
return SUFFIX_SEPARATOR.join([name, unicode(suffix), os.extsep, extension])
|
|
||||||
else:
|
|
||||||
return filename
|
|
||||||
|
|
||||||
|
|
||||||
def assemble_path_from_list(directory_list):
|
|
||||||
return os.sep.join(directory_list)
|
|
||||||
Reference in New Issue
Block a user