#NEWLINE# def gendiff( self , force = False ) : #NEWLINE# #INDENT# 'Generate a diff between self.local_settings and the example file.\n\n        ' #NEWLINE# with DirContext ( self . local_settings_dir ) as dircontext : #NEWLINE# #INDENT# if ( ( not os . path . exists ( self . local_settings_diff ) ) or force ) : #NEWLINE# #INDENT# with open ( self . local_settings_example , 'r' ) as fp : #NEWLINE# #INDENT# example_lines = fp . readlines ( ) #NEWLINE# #UNINDENT# with open ( self . local_settings_file , 'r' ) as fp : #NEWLINE# #INDENT# local_settings_lines = fp . readlines ( ) #NEWLINE# #UNINDENT# local_settings_example_mtime = time . strftime ( self . time_fmt , time . localtime ( os . stat ( self . local_settings_example ) . st_mtime ) ) #NEWLINE# local_settings_mtime = time . strftime ( self . time_fmt , time . localtime ( os . stat ( self . local_settings_file ) . st_mtime ) ) #NEWLINE# print ( ( 'generating "%s"...' % os . path . join ( dircontext . curdir , self . local_settings_diff ) ) ) #NEWLINE# with open ( self . local_settings_diff , 'w' ) as fp : #NEWLINE# #INDENT# for line in difflib . unified_diff ( example_lines , local_settings_lines , fromfile = self . local_settings_example , tofile = self . local_settings_file , fromfiledate = local_settings_example_mtime , tofiledate = local_settings_mtime ) : #NEWLINE# #INDENT# fp . write ( line ) #NEWLINE# #UNINDENT# #UNINDENT# print ( '\tDONE.' ) #NEWLINE# sys . exit ( 0 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# sys . exit ( ( '"%s" already exists.' % os . path . join ( dircontext . curdir , line . local_settings_diff ) ) )