Exemple #1
0
def fetch_promo_imgs(pk, promo_img_url, **kw):
    """
    Downloads a promo image from the location passed to the task.

    Returns False if promo image was not able to be retrieved
    """
    website = Website.objects.get(pk=pk)
    log.info(u'[Website:%s] Fetching promo img for website', website.name)
    try:
        response = _fetch_content(promo_img_url)
    except Exception, e:
        log.error(u'[Website:%s] Failed to fetch promo img for website: %s'
                  % (website, e))
        # Set the icon type to empty.
        website.update(promo_img_hash='')
        return False
Exemple #2
0
def fetch_promo_imgs(pk, promo_img_url, **kw):
    """
    Downloads a promo image from the location passed to the task.

    Returns False if promo image was not able to be retrieved
    """
    website = Website.objects.get(pk=pk)
    log.info(u'[Website:%s] Fetching promo img for website', website.name)
    try:
        response = _fetch_content(promo_img_url)
    except Exception, e:
        log.error(u'[Website:%s] Failed to fetch promo img for website: %s' %
                  (website, e))
        # Set the icon type to empty.
        website.update(promo_img_hash='')
        return False
Exemple #3
0
def fetch_icon(website, icon_url, **kw):
    """
    Downloads a website icon from the location passed to the task.

    Returns False if icon was not able to be retrieved
    """
    log.info(u'[Website:%s] Fetching icon for website', website.name)

    try:
        response = _fetch_content(icon_url)
    except Exception, e:
        log.error(u'[Website:%s] Failed to fetch icon for website: %s'
                  % (website, e))
        # Set the icon type to empty.
        website.update(icon_type='')
        return False
Exemple #4
0
def fetch_icon(pk, icon_url, sizes=mkt.CONTENT_ICON_SIZES, **kw):
    """
    Downloads a website icon from the location passed to the task.

    Returns False if icon was not able to be retrieved
    """
    website = Website.objects.get(pk=pk)
    log.info(u'[Website:%s] Fetching icon for website', website.name)

    try:
        response = _fetch_content(icon_url)
    except Exception, e:
        log.error(u'[Website:%s] Failed to fetch icon for website: %s' %
                  (website, e))
        # Set the icon type to empty.
        website.update(icon_type='')
        return False