def _wrapper(*args, **kwargs): try: return f(*args, **kwargs) except: exception.log_exception() if settings.DEBUG: return 'FAIL' else: return ''
def handle_message(self, sender, target, message): matched = None handler = None for h in self._handlers: matched = h.match(sender, message) if matched: handler = h break if not matched: rv = self.unknown(sender, message) return self.response_ok(rv) try: rv = handler.handle(sender, matched, message) return self.response_ok(rv) except exception.UserVisibleError, e: exception.log_exception() self.send_message([sender], str(e)) return self.response_error(e)
def process_view(self, request, callback, callback_args, callback_kwargs): if not settings.DEBUG: return # hotshot data if '_prof_heavy' in request.REQUEST: self.profiler = profile.Profile() args = (request,) + callback_args return self.profiler.runcall(callback, *args, **callback_kwargs) # output data for use in the profiling code if ('_prof_db' in request.REQUEST or request.META.get('HTTP_X_PROFILE', '') == 'db'): self.prof_label = common_profile.label(request.path) # output data to be included on the page if '_prof_quick' in request.REQUEST: try: common_profile.install_api_profiling() except: exception.log_exception() self.prof_label = common_profile.label(request.path)