bash_data = (bash.get_randoms( bash_cache ), bash_cache) server = None if _g_dry_run else email1.get_server(email_addr, email_pass) for name in names: to_addrs, bcc_addrs = _get_to_addrs(config, name, default_dst_addr) if (len(to_addrs) == 0): continue url = extract_an_url( names_map[name] ) if (url is None): log.warning("No image URL for '%s'", name) _send_neatza( server, email_addr, name, qotds, bash_data, url, to_addrs, bcc_addrs ) bash_cache.save() if (not _g_dry_run): server.quit() if __name__ == "__main__": _g_dry_run = 'dry-run' in sys.argv[1:] app_prep( 'neatza_app.log' ) try: main() except Exception as e: for line in traceback.format_exc().splitlines(): log.error( line )
map_ = {} for i in range(1,9999): try: id_ = 'group%d' % i map_[id_] = [ n.strip() for n in config.get ( section, id_ ).split(',') ] except: break return map_ def main(): # Read config file config = ConfigParser.RawConfigParser(allow_no_value=True) config.readfp( open( os.path.join( APP_DIR, 'app.settings' ) ) ) # Build reverse maps for names to group names sources = _build_group_map( config, 'sources' ) _update_sources( sources ) if __name__ == "__main__": app_prep( 'update_sources.log' ) try: main() except Exception as e: for line in traceback.format_exc().splitlines(): log.error( line )