Exemplo n.º 1
0
    def fill_product_attributes(self, allocine_product: Product):
        allocine_product.name = self.movie_information["title"]
        allocine_product.subcategoryId = subcategories.SEANCE_CINE.id
        allocine_product.thumbCount = 0

        self.update_from_movie_information(allocine_product,
                                           self.movie_information)

        is_new_product_to_insert = allocine_product.id is None

        if is_new_product_to_insert:
            allocine_product.id = get_next_product_id_from_database()
        self.last_product_id = allocine_product.id
    def fill_object_attributes(self, product: Product):
        product.name = trim_with_elipsis(self.product_infos["titre"], 140)
        product.datePublished = read_things_date(
            self.product_infos["date_parution"])
        subcategory = subcategories.ALL_SUBCATEGORIES_DICT[
            self.product_subcategory_id]
        product.subcategoryId = subcategory.id
        product.extraData = self.product_extra_data.copy()
        product.extraData.update(get_extra_data_from_infos(self.product_infos))

        if self.product_infos["url_extrait_pdf"] != "":
            if product.mediaUrls is None:
                product.mediaUrls = []

            product.mediaUrls.append(self.product_infos["url_extrait_pdf"])