def error_page_404(self, status, message, traceback, version): context = dict( status=status, message=message, traceback=traceback, version=version, records = len(Record.objects), collections = len(Collection.objects), templates = len(Template.objects), ) add_search_to_context(context) return render('errorpages/404.html', context)
def mediapreview(self, path, **params): try: context = dict(path=path, info=mapper.get_file_info(path)) except OSError: raise cherrypy.HTTPError(404) add_search_to_context(context) q = SearchCollection.doc_type("record").field.fileid == path records = [] for r in q[:100]: records.append(r.object) # FIXME - handle more than 100 records matching context["records"] = records return render("media-view.html", context)