def _perform_call(self, context): """ This function is called by __call__ to actually perform the controller execution. """ py_request = context.request py_config = context.config if py_config.get('i18n_enabled', True): setup_i18n(context) state, params = self._get_dispatchable(context, py_request.quoted_path_info) func, controller, remainder = state.method, state.controller, state.remainder if hasattr(controller, '_before'): controller._before(*remainder, **params) self._setup_wsgi_script_name(state.path, remainder, params) r = self._call(func, params, remainder=remainder, context=context) if hasattr(controller, '_after'): controller._after(*remainder, **params) return r
def _perform_call(self, thread_locals): """ This function is called from within Pylons and should not be overidden. """ py_request = thread_locals.request py_config = thread_locals.config if py_config.get('i18n_enabled', True): setup_i18n(thread_locals) url_path = py_request.path.split('/')[1:] if url_path[-1] == '': url_path.pop() func, controller, remainder, params = self._get_dispatchable( thread_locals, url_path) if hasattr(controller, '_before'): controller._before(*remainder, **params) self._setup_wsgi_script_name(url_path, remainder, params) r = self._call(func, params, remainder=remainder, tgl=thread_locals) if hasattr(controller, '_after'): controller._after(*remainder, **params) return r
def _perform_call(self, func, args): setup_i18n() routingArgs = None if isinstance(args, dict) and 'url' in args: routingArgs = args['url'] try: controller, remainder, params = self._get_routing_info(routingArgs) # this has to be done before decorated controller is called because # otherwise the controller method will get sent, and the function name will # be lost. func_name = func.__name__ if not args: args = [] if func_name == '__before__' or func_name == '__after__': if func_name == '__before__' and hasattr( controller.im_class, '__before__'): return controller.im_self.__before__(*args) if func_name == '__after__' and hasattr( controller.im_class, '__after__'): return controller.im_self.__after__(*args) return result = DecoratedController._perform_call(self, controller, params, remainder=remainder) except HTTPException, httpe: result = httpe # 304 Not Modified's shouldn't have a content-type set if result.status_int == 304: result.headers.pop('Content-Type', None) result._exception = True
def _perform_call(self, thread_locals): """ This function is called from within Pylons and should not be overidden. """ py_request = thread_locals.request py_config = thread_locals.config if py_config.get('i18n_enabled', True): setup_i18n(thread_locals) url_path = py_request.path.split('/')[1:] if url_path[-1] == '': url_path.pop() func, controller, remainder, params = self._get_dispatchable(thread_locals, url_path) if hasattr(controller, '_before'): controller._before(*remainder, **params) self._setup_wsgi_script_name(url_path, remainder, params) r = self._call(func, params, remainder=remainder, tgl=thread_locals) if hasattr(controller, '_after'): controller._after(*remainder, **params) return r
def _perform_call(self, context): """ This function is called from within Pylons and should not be overidden. """ py_request = context.request py_config = context.config if py_config.get('i18n_enabled', True): setup_i18n(context) state, params = self._get_dispatchable(context, py_request.quoted_path_info) func, controller, remainder = state.method, state.controller, state.remainder if hasattr(controller, '_before'): controller._before(*remainder, **params) self._setup_wsgi_script_name(state.path, remainder, params) r = self._call(func, params, remainder=remainder, context=context) if hasattr(controller, '_after'): controller._after(*remainder, **params) return r
def _perform_call(self, func, args): """Called from within Pylons and should not be overridden.""" if pylons.config.get('i18n_enabled', True): setup_i18n() script_name = pylons.request.environ.get('SCRIPT_NAME', '') url_path = pylons.request.path if url_path.startswith(script_name): url_path = url_path[len(script_name):] url_path = url_path.split('/')[1:] if url_path[-1] == '': url_path.pop() func, controller, remainder, params = self._get_dispatchable(url_path) if hasattr(controller, '_before'): controller._before(*args, **args) self._setup_wsgi_script_name(url_path, remainder, params) r = self._call(func, params, remainder=remainder) if hasattr(controller, '_after'): controller._after(*args, **args) return r
def _perform_call(self, func, args): """Called from within Pylons and should not be overridden.""" if pylons.config.get("i18n_enabled", True): setup_i18n() script_name = pylons.request.environ.get("SCRIPT_NAME", "") url_path = pylons.request.path if url_path.startswith(script_name): url_path = url_path[len(script_name) :] url_path = url_path.split("/")[1:] if url_path[-1] == "": url_path.pop() func, controller, remainder, params = self._get_dispatchable(url_path) if hasattr(controller, "_before"): controller._before(*args, **args) self._setup_wsgi_script_name(url_path, remainder, params) r = self._call(func, params, remainder=remainder) if hasattr(controller, "_after"): controller._after(*args, **args) return r
def _perform_call(self, func, args): """ This function is called from within Pylons and should not be overidden. """ if pylons.config.get('i18n_enabled', True): setup_i18n() script_name = pylons.request.environ.get('SCRIPT_NAME', '') url_path = pylons.request.path if url_path.startswith(script_name): url_path = url_path[len(script_name):] url_path = url_path.split('/')[1:] if url_path[-1] == '': url_path.pop() func, controller, remainder, params = self._get_dispatchable(url_path) if hasattr(controller, '__before__') and not hasattr(controller, '_before'): warn("this functionality is going to removed in the next minor version,"\ " please use _before instead." ) controller.__before__(*args) if hasattr(controller, '_before'): controller._before(*args) self._setup_wsgi_script_name(url_path, remainder, params) r = self._call(func, params, remainder=remainder) if hasattr(controller, '__after__'): warn( "this functionality is going to removed in the next minor version," " please use _after instead.") controller.__after__(*args) if hasattr(controller, '_after'): controller._after(*args) return r
def _perform_call(self, func, args): """ This function is called from within Pylons and should not be overidden. """ if pylons.config.get('i18n_enabled', True): setup_i18n() script_name = pylons.request.environ.get('SCRIPT_NAME', '') url_path = pylons.request.path if url_path.startswith(script_name): url_path = url_path[len(script_name):] url_path = url_path.split('/')[1:] if url_path[-1] == '': url_path.pop() func, controller, remainder, params = self._get_dispatchable(url_path) if hasattr(controller, '__before__') and not hasattr(controller, '_before'): warn("this functionality is going to removed in the next minor version,"\ " please use _before instead." ) controller.__before__(*args) if hasattr(controller, '_before'): controller._before(*args) self._setup_wsgi_script_name(url_path, remainder, params) r = self._call(func, params, remainder=remainder) if hasattr(controller, '__after__'): warn("this functionality is going to removed in the next minor version," " please use _after instead.") controller.__after__(*args) if hasattr(controller, '_after'): controller._after(*args) return r