@cronjobs.register
def cleanup_image_files():
 log.info('Removing one day old temporary image files for themes.')
 for folder in ('persona_footer', 'persona_header'):
  root = os.path.join(settings.TMP_PATH, folder)
  if (not os.path.exists(root)):
   continue
  for path in os.listdir(root):
   full_path = os.path.join(root, path)
   age = (time.time() - os.stat(full_path).st_atime)
   if (age > ((60 * 60) * 24)):
    log.debug(('Removing image file: %s, %dsecs old.' % (full_path, age)))
    os.unlink(full_path)

@ cronjobs . register def cleanup_image_files ( ) : log . info ( 'Removing one day old temporary image files for themes.' ) for folder in ( 'persona_footer' , 'persona_header' ) : root = os . path . join ( settings . TMP_PATH , folder ) if ( not os . path . exists ( root ) ) : continue for path in os . listdir ( root ) : full_path = os . path . join ( root , path ) age = ( time . time ( ) - os . stat ( full_path ) . st_atime ) if ( age > ( ( 60 * 60 ) * 24 ) ) : log . debug ( ( 'Removing image file: %s, %dsecs old.' % ( full_path , age ) ) ) os . unlink ( full_path )
clean up all header and footer images files for themes .