Updated document indexing app modules for the new

filename and extension merged field
This commit is contained in:
Roberto Rosario
2011-11-30 08:55:19 -04:00
parent f554655688
commit d37b36bce3
3 changed files with 15 additions and 11 deletions

View File

@@ -1,8 +1,16 @@
import os
from document_indexing.conf.settings import SUFFIX_SEPARATOR
def assemble_document_filename(document, suffix=0):
def assemble_document_filename(filename, suffix=0):
'''
Split document filename, to attach suffix to the name part then
re attacht the extension
'''
if suffix:
return SUFFIX_SEPARATOR.join([document.file_filename, unicode(suffix)])
name, extension = filename.split(os.split(os.extsep))
return SUFFIX_SEPARATOR.join([name, unicode(suffix), os.extsep, extension])
else:
return document.file_filename
return file_filename