def _common(self): global REPO_EXTENSION_DIRS, ALLOW_OLD_EXTENSIONS if not REPO_EXTENSION_DIRS: conf = configurator.default_configurator() REPO_EXTENSION_DIRS = PATH_SEPARATOR.join(( os.path.join(self.repo.overhead_folder(), "extensions", "active"), os.path.join(conf.get('uplib-lib'), 'site-extensions'))) ALLOW_OLD_EXTENSIONS = conf.get_bool("allow-old-extensions") module_name, function_name = self.angel_action[0] exception = None callable = None try: callable = find_action_function(module_name, function_name, self.repo.get_actions_path()) except: t, v, b = sys.exc_info() exception = ''.join(traceback.format_exception(t, v, b)) note(0, "find_action_function(%s/%s) raised an exception:\n%s", module_name, function_name, exception) if callable: field_values = request_to_field_dict(self.request) or {} try: resp = response(self, self.current_user is not None) callable(self.repo, resp, field_values) return True except ForkRequestInNewThread, x: note(4, "forked off request") self._auto_finish = False return False except:
def do_action (self, request, field_values, content): note(4, "in do_action (%s)", request.angel_action) global REPO_EXTENSION_DIRS, ALLOW_OLD_EXTENSIONS if not REPO_EXTENSION_DIRS: conf = configurator.default_configurator() REPO_EXTENSION_DIRS = PATH_SEPARATOR.join(( os.path.join(self.__repo__.overhead_folder(), "extensions", "active"), os.path.join(conf.get('uplib-lib'), 'site-extensions'))) ALLOW_OLD_EXTENSIONS = conf.get_bool("allow-old-extensions") module_name, function_name = request.angel_action[0] exception = None callable = None try: callable = find_action_function(module_name, function_name, self.__repo__.get_actions_path()) except: t, v, b = sys.exc_info() exception = ''.join(traceback.format_exception(t, v, b)) note(0, "find_action_function(%s/%s) raised an exception:\n%s", module_name, function_name, exception) if callable: try: self.action_counter.increment() if field_values == None: field_values = {} logged_in = is_logged_in(self.__repo__, request) resp = response(request, content, self.__repo__, logged_in) if module_name == 'basic' and function_name == 'repo_status_json': # try not to log this call request.log = _ignore_request_logging callable(self.__repo__, resp, field_values) return true except ForkRequestInNewThread, x: note(4, "forked off request") return false except Exception, x: note(0, "signalling exception <%s> at point 1a:", x) excn_data = sys.exc_info() signal_python_exception(request, excn_data) # s2 = python_exception_html (excn_data, None) # request.reply_code = 500 # request['Content-Type'] = 'text/html' # request['Content-Length'] = len(s2) # request.push(s2) return true