def run(): inteum = Inteum(INTEUM_DSN) allPacks = inteum.get_technologies() print 'Total: %s' % len(allPacks) qb = QuickBooks(applicationName=QUICKBOOKS_APPLICATION_NAME) itemName = 'Customer' newPacks = get_new(qb, itemName, allPacks, transform, equal) print 'New: %s' % len(newPacks) if not newPacks: return if raw_input('Proceed (y/[n])? ').lower() != 'y': return add_new(qb, itemName, newPacks, untransform)
from test7 import Inteum from quickbooks import QuickBooks from parameters import INTEUM_DSN, QUICKBOOKS_APPLICATION_NAME # Load technologies from Inteum inteum = Inteum(INTEUM_DSN) allTechnologies = inteum.get_technologies() # Load technologies from QuickBooks quickbooks = QuickBooks(applicationName=QUICKBOOKS_APPLICATION_NAME) oldTechnologies = [] for result in quickbooks.call('CustomerQueryRq', {}): customerName = result.get('Name') technologyCase, separator, technologyTitle = customerName.partition('-') oldTechnologies.append({ 'case': technologyCase.strip(), 'title': technologyTitle.strip(), }) newTechologies = [] for oneTechnology in allTechnologies: for oldTechnology in oldTechnologies: if oneTechnology['case'] != oldTechnology['case']: continue if oneTechnology['title'] != oldTechnology['title']: print 'MISMATCH' print oneTechnology print oldTechnology continue else: