#NEWLINE# def get_growl_image( url ) : #NEWLINE# #INDENT# cache_folder = os . path . join ( tempfile . gettempdir ( ) , 'profile image cache' ) #NEWLINE# if ( not os . path . exists ( cache_folder ) ) : #NEWLINE# #INDENT# os . makedirs ( cache_folder ) #NEWLINE# #UNINDENT# fname = ( '%s.%s' % ( hashlib . md5 ( url ) . hexdigest ( ) , url . split ( '.' ) [ ( - 1 ) ] ) ) #NEWLINE# cached_image = os . path . join ( cache_folder , fname ) #NEWLINE# image = None #NEWLINE# if os . path . exists ( cached_image ) : #NEWLINE# #INDENT# mtime = os . path . getmtime ( cached_image ) #NEWLINE# if ( ( time . time ( ) - mtime ) > ( ( ( 60 * 60 ) * 24 ) * 3 ) ) : #NEWLINE# #INDENT# os . remove ( cached_image ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# image = Growl . Image . imageFromPath ( cached_image ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# f = open ( cached_image , 'wb' ) #NEWLINE# f . write ( urllib2 . urlopen ( url ) . read ( ) ) #NEWLINE# f . close ( ) #NEWLINE# image = Growl . Image . imageFromPath ( cached_image ) #NEWLINE# #UNINDENT# return image