if size in ('#N/A', '0'): size = None image_path = os.path.join("f:/tmp/upload", image) if not os.path.isfile(image_path): print " [ERROR] missing image:", image_path image_path = None # build the name name = "%s %s %s" % (style, row['Style'], product_type) try: product = doveprod.get_or_make_product(product_key=name, name=name, category=category, product_type=product_type, description=description, vendor=vendor, style=style) except categories.InvalidProductTypeError as e: error("Invalid product type '%s' for %s" % (product_type, sku)) continue # each row is a size; no prices in FoA data try: product.add_variant(size, sku, price=0, weight=weight, dimensions=dimensions, color=color,
or (category=='Living' and product_type=='Cabinet') \ or (category=='Living' and product_type=='Coffee Table') \ or (category=='Living' and product_type=='End Table') \ or (category=='Living' and product_type=='Pier Cabinet') \ or (category=='Home Office' and product_type=='Office Chair') \ or (category=='Accessories' and product_type=='Mirror') \ or (category=='Accessories' and product_type=='Wall Decor'): # for certain product types, the source data doesn't give us a way # to differentiate two products with the same name pkey = name + " " + str(uid) uid += 1 p = doveprod.get_or_make_product(product_key=pkey, name=name, category=category, product_type=product_type, description=description, vendor="Ashley", style=style) if sku == 'B130-382': additional_info['feature'] = 'High Headboard' elif sku == 'H636-44': additional_info['feature'] = "w/ Drawers" elif sku == 'B693-92': additional_info['feature'] = '2 Drawers' elif sku == 'B693-93': additional_info['feature'] = '3 Drawers' elif sku == 'B693-91': additional_info['feature'] = '1 Drawer' elif sku == 'B251-92': additional_info['feature'] = '3 Drawers' sizes = additional_info.get('size', None) if not isinstance(sizes, list): sizes = [sizes]