Example #1
0
                if locale not in Environment.instance().fixtures["locales"]:
                    raise IngestError("locale '{0}' is invalid".format(locale))

                command_logger.info(
                    "PROCESSING FOR COUNTRY:{0} LOCALE:{1} CHANNEL:{2}".format(
                        country_code, locale, channel_id))

                new_tiles_list = []

                for t in tiles:
                    if is_compact and not populate_image_uris(t, assets):
                        continue

                    columns = _create_tile_record(t, channel_id, locale)
                    db_tile_id, ag_id = tile_exists(session, **columns)
                    f_tile_id = t.get("directoryId")

                    if db_tile_id is None or ag_id is None:
                        # Will generate a new id if not found in db
                        db_tile_id, ag_id = insert_tile(session, **columns)
                        t["directoryId"] = db_tile_id
                        log_msg = "INSERT: Creating id:{0}".format(db_tile_id)

                    elif db_tile_id == f_tile_id:
                        log_msg = "NOOP: id:{0} already exists".format(
                            f_tile_id)

                    else:
                        # Either f_tile_id was not provided or the id's provided differ
                        t["directoryId"] = db_tile_id
Example #2
0
                        title=t["title"],
                        typ=t["type"],
                        image_uri=image_hash,
                        enhanced_image_uri=enhanced_image_hash,
                        locale=locale,
                        frecent_sites=frecent_sites,
                        time_limits=time_limits,
                        frequency_caps=frequency_caps,
                        adgroup_name=adgroup_name,
                        explanation=explanation,
                        check_inadjacency=check_inadjacency,
                        channel_id=channel_id,
                        conn=conn
                    )

                    db_tile_id, ag_id = tile_exists(**columns)
                    f_tile_id = t.get("directoryId")

                    if db_tile_id is None or ag_id is None:
                        """
                        Will generate a new id if not found in db
                        """
                        db_tile_id, ag_id = insert_tile(**columns)
                        t["directoryId"] = db_tile_id
                        new_tiles_list.append(remove_unserializable_data(t))
                        command_logger.info("INSERT: Creating id:{0}".format(db_tile_id))

                    elif db_tile_id == f_tile_id:
                        new_tiles_list.append(remove_unserializable_data(t))
                        command_logger.info("NOOP: id:{0} already exists".format(f_tile_id))
Example #3
0
                    raise IngestError("country_code '{0}' is invalid".format(country_code))

                if locale not in Environment.instance().fixtures["locales"]:
                    raise IngestError("locale '{0}' is invalid".format(locale))

                command_logger.info("PROCESSING FOR COUNTRY:{0} LOCALE:{1} CHANNEL:{2}"
                                    .format(country_code, locale, channel_id))

                new_tiles_list = []

                for t in tiles:
                    if is_compact and not populate_image_uris(t, assets):
                        continue

                    columns = _create_tile_record(t, channel_id, locale)
                    db_tile_id, ag_id = tile_exists(session, **columns)
                    f_tile_id = t.get("directoryId")

                    if db_tile_id is None or ag_id is None:
                        # Will generate a new id if not found in db
                        db_tile_id, ag_id = insert_tile(session, **columns)
                        t["directoryId"] = db_tile_id
                        log_msg = "INSERT: Creating id:{0}".format(db_tile_id)

                    elif db_tile_id == f_tile_id:
                        log_msg = "NOOP: id:{0} already exists".format(f_tile_id)

                    else:
                        # Either f_tile_id was not provided or the id's provided differ
                        t["directoryId"] = db_tile_id
                        log_msg = "IGNORE: Tile already exists with id: {1}".format(f_tile_id, db_tile_id)