Beispiel #1
0
def find_sector_from_name(goodname, slist):
	result = utility.get_default_error()
	ig = utility.canonical_good(goodname).upper().strip()
	for s in slist:
		cg = utility.canonical_good(s['Good_Name']).upper().strip()
		if (utility.goods_equal(ig, cg)):
			result = s['Good_Sector']
			break
	return result
Beispiel #2
0
def find_goods_in_sector(sector, slist):
	result = utility.get_default_error()
	searchstring = sector.upper().strip()
	runner = []
	for sec in slist:
		if (searchstring == (sec['Good_Sector'].upper().strip())):
			cg = utility.canonical_good(sec['Good_Name']).strip()
			if (cg not in runner):
				runner.append(sec['Good_Name'].strip())
	if (len(runner) > 0):
		result = sorted(runner)
	return result