Ejemplo n.º 1
0
def tag_category(imp_catalog_page_id=None, creation_date=None):
    from price.modules.imp_price.services import Services
    from price.tasks import add_category_assignment
    s = Services()
    for result in s.get_list_pages(imp_catalog_page_id, creation_date):
        log.info('Order tag category {}'.format(result))
        tp = s.get_tagging_product(result.imp_catalog_page_id)
        add_category_assignment.delay(tp)
Ejemplo n.º 2
0
def tag_unprocessed(scan_date=None):
    from price.modules.imp_price.services import Services
    from price.tasks import add_brand_assignment, add_category_assignment
    s = Services()
    for imp_catalog_page_id in s.get_unprocessed_pages(scan_date):
        log.info('Order Imp_catalog_page: {}'.format(imp_catalog_page_id))
        tp = s.get_tagging_product(imp_catalog_page_id)
        add_brand_assignment.delay(tp)
        add_category_assignment.delay(tp)
Ejemplo n.º 3
0
def add_category_synonym(value):
    from price.modules.tager.services import Services
    from price.modules.imp_price.services import Services as ImpServices
    from price.tasks import add_category_assignment
    s = Services()
    imps = ImpServices()
    s.add_category_synonym(value)
    list_imp_catalog_page_id = get(
        'http://127.0.0.1:7001/catalog_page_search/category/{}'.format(value))
    for imp_catalog_page_id in list_imp_catalog_page_id:
        tp = imps.get_tagging_product(imp_catalog_page_id)
        if tp:
            log.info('Order category_assignment ImpID: {} Title: {}'.format(
                imp_catalog_page_id, tp.get('catalog_title')))
            add_category_assignment.delay(tp)
    for imp_catalog_page_id in list_imp_catalog_page_id:
        tp = imps.get_tagging_product(imp_catalog_page_id)
        if tp:
            log.info('Order tagging_product ImpID: {} Title: {}'.format(
                imp_catalog_page_id, tp.get('catalog_title')))
            tagging_product(imp_catalog_page_id, tp.get('catalog_title'))
Ejemplo n.º 4
0
def tag_brand(imp_catalog_page_id=None, creation_date=None):
    from price.modules.imp_price.services import Services
    from price.tasks import add_brand_assignment
    log.info('tag_brand params:%r, %r)', imp_catalog_page_id, creation_date)
    s = Services()
    no = 1
    for imp_catalog_page_id, name in s.get_list_pages(imp_catalog_page_id,
                                                      creation_date):
        # log.info('Order tag brand {}'.format(imp_catalog_page_id))
        tp = s.get_tagging_product(imp_catalog_page_id)
        add_brand_assignment.delay(tp)
        no = no + 1
    log.info('tag_brand: order {} tasks'.format(no))