#NEWLINE# def clean_cache_key( key ) : #NEWLINE# #INDENT# "Replace spaces with '-' and hash if length is greater than 250." #NEWLINE# cache_key = re . sub ( '\\s+' , '-' , key ) #NEWLINE# cache_key = smart_str ( cache_key ) #NEWLINE# if ( len ( cache_key ) > 250 ) : #NEWLINE# #INDENT# m = md5 ( ) #NEWLINE# m . update ( cache_key ) #NEWLINE# cache_key = ( ( cache_key [ : 200 ] + '-' ) + m . hexdigest ( ) ) #NEWLINE# #UNINDENT# return cache_key