if 'GATEWAY_INTERFACE' not in environ: kiva_id = environ["USER"] else: exit(3) else: kiva_id = options.kiva_id lender.check_lender_id(kiva_id) my_countries, not_loaned = lender.read_lender_csv(kiva_id,private,verbose,display) # # Check for loans in countries we haven't hit yet. # loans_found = loan.find_new_loans(not_loaned,loan_count,verbose) if newonly: print "Searched all new countries." exit(0) if len(loans_found) < loan_count: print "Found %s loans for new countries. Looking for less used countries." % len(loans_found) loans_found = loan.find_old_loans(loans_found,my_countries,loan_count,verbose) if verbose: print "Not sure how we ended up here..." if len(loans_found) > 0: loan.display_link(loans_found) exit(3)
# # Done deciding if we're CGI or CLI # my_countries, not_loaned = lender.read_lender_file(kiva_id,private,verbose,display) loans_found = loan.find_new_loans(not_loaned,loan_count,verbose) if newonly: print "Searched all new countries." exit(0) if rss: import country codes = country.get_codes(not_loaned) loan.display_link(codes,rss) if len(loans_found) < loan_count: print "Found %s loans for new countries. Looking for less used countries." % len(loans_found) loans_found = loan.find_old_loans(loans_found,my_countries,loan_count,verbose) if verbose: print "Looks like we ran out of countries..." if len(loans_found) > 0: loan.display_link(loans_found) if 'GATEWAY_INTERFACE' in os.environ: print '</p>' exit(3)