Exemplo n.º 1
0
def user_product(user_id, tiid):

    if user_id == "embed":
        abort(410)

    user = get_user_for_response(user_id, request)
    try:
        requested_product = [p for p in user.products if p["_id"] == tiid][0]
    except IndexError:
        abort_json(404, "That product doesn't exist.")

    prepped = product.prep_product(requested_product, True)

    return json_resp_from_thing(prepped)
Exemplo n.º 2
0
def prep(products_dict, include_headings=False):

    prepped_products = []

    for product_dict in products_dict:

        try:
            prepped_products.append(product.prep_product(product_dict))
        except product.GenreDeprecatedError:
            pass

    if include_headings:
        prepped_products += make_heading_products(prepped_products)
        #prepped_products = remove_account_products(prepped_products)

    return prepped_products