#NEWLINE# def handle( self , * args , **options ) : #NEWLINE# #INDENT# collectedless = [ os . path . join ( root , file ) for ( root , dir , files ) in os . walk ( settings . STATIC_ROOT ) for file in files if file . endswith ( '.less' ) ] #NEWLINE# for less_file in collectedless : #NEWLINE# #INDENT# with codecs . open ( less_file , 'r' , 'utf-8' ) as fd : #NEWLINE# #INDENT# content = fd . read ( ) #NEWLINE# if ( content is not None ) : #NEWLINE# #INDENT# if ( BOWER_PATH in content ) : #NEWLINE# #INDENT# print ( 'Updated less @imports in {}' . format ( less_file ) ) #NEWLINE# content = content . replace ( BOWER_PATH , '../..' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# p = re . search ( B3_REGEX , content ) #NEWLINE# if ( p is not None ) : #NEWLINE# #INDENT# path_def = p . group ( 0 ) #NEWLINE# path_file = path_def . split ( '-' ) [ ( - 2 ) ] #NEWLINE# new_path = settings . LESS_B3_PATHS . get ( path_file ) #NEWLINE# if ( new_path is not None ) : #NEWLINE# #INDENT# print ( ( '[CORRECTING] %(f_name)s path in %(less_file)s: %(new_path)s' % { #NEWLINE# #INDENT# 'f_name' : path_file , #NEWLINE# 'less_file' : less_file , #NEWLINE# 'new_path' : new_path , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# content = re . sub ( B3_REGEX , new_path , content ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# content = None #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# content = None #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if ( content is not None ) : #NEWLINE# #INDENT# with open ( less_file , 'w' ) as fd : #NEWLINE# #INDENT# fd . write ( content )