@@ -0,0 +1,1097 @@
+# app imports%0Afrom oweb.exceptions import OWebDoesNotExist%0A%0Adef get_object_or_404(klass, *args, **kwargs):%0A    %22%22%22%0A    Uses get() to return an object, or raises a Http404 exception if the object%0A    does not exist.%0A%0A    klass may be a Model, Manager, or QuerySet object. All other passed%0A    arguments and keyword arguments are used in the get() query.%0A%0A    Note: Like with get(), an MultipleObjectsReturned will be raised if more than one%0A    object is found.%0A    %22%22%22%0A    queryset = _get_queryset(klass)%0A    try:%0A        return queryset.get(*args, **kwargs)%0A    except queryset.model.DoesNotExist:%0A        raise OWebDoesNotExist%0A%0Adef get_list_or_404(klass, *args, **kwargs):%0A    %22%22%22%0A    Uses filter() to return a list of objects, or raise a Http404 exception if%0A    the list is empty.%0A%0A    klass may be a Model, Manager, or QuerySet object. All other passed%0A    arguments and keyword arguments are used in the filter() query.%0A    %22%22%22%0A    queryset = _get_queryset(klass)%0A    obj_list = list(queryset.filter(*args, **kwargs))%0A    if not obj_list:%0A        raise OWebDoesNotExist%0A    return obj_list%0A

Make our own version of get_object_or_404 and get_list_or_404