def wrapped_handler500(request): from oioioi.base.views import handler500 r = WSGIRequest(request) r.session = import_module(settings.SESSION_ENGINE).SessionStore() if self._user: r.user = self._user self._req = r return handler500(r)