def mapGroup(categorieList): where = {} if not categorieList: return where #log.info(categorieList) for cat in categorieList: for group, categories in groupMap.items(): if cat in categories: if group in where: where[group] = where[group] + 1 else: where[group] = 1 return where
def mapGroup(categorieList): where = {} if not categorieList: return where #log.info(categorieList) for cat in categorieList: for group,categories in groupMap.items(): if cat in categories: if group in where: where[group] = where[group] +1 else: where[group] = 1 return where
def getGroup( categorieList): where = {} for cat in categorieList: for group,categories in groupMap.items(): if cat in categories: if where.has_key(group): where[group] = where[group] +1 else: where[group] = 1 tmp = 0 t_key = "" for key, value in where.items(): if value > tmp: t_key = key tmp = value return t_key