Package tlib :: Package base :: Module FileHelper
[hide private]
[frames] | no frames]

Source Code for Module tlib.base.FileHelper

 1  import os 
 2  import re 
 3  from uuid import uuid4 
 4   
 5   
 6  MAX_CHARS_IN_ONE_LINE = 20000 
 7   
 8  __CSL = None 
24   
25 -def get_filename_from_string(value):
26 """ 27 Returns original string minus any characters that are invalid in file names 28 @param value: String to convert to a valid file name 29 @type value: str 30 @rtype: str 31 """ 32 return re.sub(r'[\\/:?]', '_', value)[:100]+"_"+uuid4().hex
33