def process_response(self, request, response):
        if response.status_code != 404: return response
        if request.path in utils.global_blog_dict:
            return show_post(request)
        if request.path in utils.global_wiki_dict:
            try: return show_wiki(request)
            except http.Http404: return response # original 404 error
        if request.path in utils.global_redirect_dict:
            return http.HttpResponsePermanentRedirect(
                utils.global_redirect_dict[request.path]
            )
        if not request.path.endswith("/"):
            if "%s/" % request.path in utils.global_blog_dict:
                return http.HttpResponsePermanentRedirect(request.path + "/")
            elif "." not in request.path.rsplit("/", 1)[-1]:
                try:
                    urlresolvers.resolve(
                        request.path_info
                    )
                except urlresolvers.Resolver404: 
                    return http.HttpResponseRedirect(request.path + "/")
                else:
                    return http.HttpResponsePermanentRedirect(
                        request.path + "/"
                    )
        return response # must be real 404!
dataset/ETHPy150Open amitu/gitology/src/gitology/d/middleware.py/URLConfMiddleware.process_response/original