def brand_category_page(request, brandname, catname):
    try:
        cat = BrandCategory.objects.by_slug(brandname, catname)
        
    except Brand.DoesNotExist:
        raise Http404(_('Brand "%s" does not exist') % brandname)
        
    except BrandCategory.DoesNotExist:
        raise Http404(_('No category "%{category}s" in brand "%{brand}s"').format(category=catname, brand=brandname))
        
    products = list(cat.active_products())
    sale = find_best_auto_discount(products)
    
    ctx = RequestContext(request, {
        'brand' : cat,
        'sale' : sale,
    })
    return render_to_response('brand/view_brand.html', context_instance=ctx)
dataset/ETHPy150Open dokterbob/satchmo/satchmo/apps/satchmo_ext/brand/views.py/brand_category_page/original