def get_wishes(): user_id = g.user_id website = request.args['weburl'] host_data = scrapedoc.check_host(website) if host_data: price_class, brand_class = [host_data.price_class], host_data.brand_class else: brand_class = scrapedoc.split_class(request.args['items']) price_class = brand_class groups = model.Wishlist.search_groups(user_id.id) brand = scrapedoc.first_time(website, brand_class) images = scrapedoc.find_images(website) prices = scrapedoc.find_best_price_div(website, price_class) host = scrapedoc.get_host(website) image_src = scrapedoc.find_images(website) return render_template("get_wish.html", brand = brand, images = images, website = website, prices = prices, host=host, image_src = image_src, groups=groups)
def newitem(): user_id = g.user_id website = request.form['specific_url'] brand = (request.form['brandname'] or request.form['brandname_other']).split("|") price = (request.form['price'] or request.form['price_other']).split("|") item_group = request.form['item_group'] or request.form['item_group_other'] host = request.form['host'] image_src = request.form['image_src'] if len(brand) == 1: brand =[ None, brand[0]] if len(price) == 1: price =[ None, price[0]] if scrapedoc.check_host(website) == None: model.Website.new(host, str(price[0]), str(brand[0]), None) item=model.Item.new(brand[1], item_group, price[1], website, host, image_src) model.Wishlist.new(user_id.id, item) return redirect("/main_wishes")