Exemplo n.º 1
0
 def inner(request, *args, **kwargs):
     try:
         return view(request, *args, **kwargs)
     except Http404:
         context = build_default_context()
         context['product'] = kwargs.get('product', 'No product')
         return render(request,
                       'home/missing_product.html',
                       context,
                       status=404)
Exemplo n.º 2
0
 def inner(request, *args, **kwargs):
     product = kwargs.get('product', request.GET.get('product', None))
     versions = kwargs.get('versions', request.GET.get('versions', None))
     try:
         kwargs['default_context'] = utils.build_default_context(
             product, versions)
     except Http404 as e:
         # A 404 will be raised if the product doesn't exist, or if the
         # version does not exist for that product.
         # In the latter case, we want to redirect the user to that
         # product's home page. If the product is missing, superusers
         # should be sent to the admin panel to add that product, while
         # regular users will see a 404.
         if 'version' in str(e):
             return redirect(
                 reverse('crashstats:product_home', args=(product, )))
         raise
     return view(request, *args, **kwargs)
Exemplo n.º 3
0
 def inner(request, *args, **kwargs):
     product = kwargs.get('product', request.GET.get('product', None))
     versions = kwargs.get('versions', request.GET.get('versions', None))
     try:
         kwargs['default_context'] = utils.build_default_context(
             product,
             versions
         )
     except Http404 as e:
         # A 404 will be raised if the product doesn't exist, or if the
         # version does not exist for that product.
         # In the latter case, we want to redirect the user to that
         # product's home page. If the product is missing, superusers
         # should be sent to the admin panel to add that product, while
         # regular users will see a 404.
         if 'version' in str(e):
             return redirect(reverse('crashstats:product_home', args=(product,)))
         raise
     return view(request, *args, **kwargs)
Exemplo n.º 4
0
 def inner(request, *args, **kwargs):
     product_name = kwargs.get("product", request.GET.get("product", None))
     versions = kwargs.get("versions", request.GET.get("versions", None))
     try:
         kwargs["default_context"] = utils.build_default_context(
             product_name, versions
         )
     except Http404 as e:
         # A 404 will be raised if the product doesn't exist, or if the version does
         # not exist for that product.
         #
         # In the latter case, we want to redirect the user to that product's home
         # page. If the product is missing, superusers should be sent to the admin
         # panel to add that product, while regular users will see a 404.
         if "version" in str(e):
             return redirect(
                 reverse("crashstats:product_home", args=(product_name,))
             )
         raise
     return view(request, *args, **kwargs)