コード例 #1
0
ファイル: tablerequest.py プロジェクト: gary-ops/lino
 def __repr__(self):
     kw = dict()
     if self.master_instance is not None:
         kw.update(master_instance=obj2str(self.master_instance))
     if self.filter is not None:
         kw.update(filter=repr(self.filter))
     if self.known_values:
         kw.update(known_values=self.known_values)
     if self.requesting_panel:
         kw.update(requesting_panel=self.requesting_panel)
     u = self.get_user()
     if u is not None:
         kw.update(user=u.username)
     if False:  # self.request:
         kw.update(request=format_request(self.request))
     return "<%s %s(%s)>" % (self.__class__.__name__,
                             self.bound_action.full_name(), kw)
コード例 #2
0
ファイル: tablerequest.py プロジェクト: DarioGT/lino
 def __repr__(self):
     kw = dict()
     if self.master_instance is not None:
         kw.update(master_instance=obj2str(self.master_instance))
     if self.filter is not None:
         kw.update(filter=repr(self.filter))
     if self.known_values:
         kw.update(known_values=self.known_values)
     if self.requesting_panel:
         kw.update(requesting_panel=self.requesting_panel)
     u = self.get_user()
     if u is not None:
         kw.update(user=u.username)
     if False:  # self.request:
         kw.update(request=format_request(self.request))
     return "<%s %s(%s)>" % (
         self.__class__.__name__, self.bound_action.full_name(), kw)
コード例 #3
0
    def process_exception(self, request, exception):
        if request.is_ajax():
            (exc_type, exc_info, tb) = sys.exc_info()

            # response to client:
            response = "%s: " % exc_type.__name__
            response += "%s" % exc_info

            if not isinstance(exception, self.no_traceback):
                # message to be logged:
                msg = "AjaxExceptionResponse {0}\n".format(response)
                msg += "\nin request {0}\n".format(format_request(request))
                msg += "TRACEBACK:\n"
                for tb in traceback.format_tb(tb):
                    msg += smart_text(tb)
                if settings.DEBUG:
                    settings.SITE.logger.warning(msg)
                else:
                    settings.SITE.logger.exception(msg)

            return HttpResponse(response, status=400)
コード例 #4
0
ファイル: ajax.py プロジェクト: TonisPiip/lino
    def process_exception(self, request, exception):
        if request.is_ajax():
            (exc_type, exc_info, tb) = sys.exc_info()

            # response to client:
            response = "%s: " % exc_type.__name__
            response += "%s" % exc_info

            # message to be logged:
            msg = "AjaxExceptionResponse {0}\n".format(response)
            msg += "\nin request {0}\n".format(format_request(request))
            msg += "TRACEBACK:\n"
            for tb in traceback.format_tb(tb):
                msg += smart_text(tb)
            if settings.DEBUG:
                settings.SITE.logger.warning(msg)
            else:
                settings.SITE.logger.exception(msg)

            if isinstance(exception, PermissionDenied):
                return HttpResponseForbidden(response)
            if isinstance(exception, ObjectDoesNotExist):
                return HttpResponseBadRequest(response)
            return HttpResponseServerError(response)