(self, func)
return result
Calls a function with arguments from
        :meth:`_get_method_args`

        Given a function, inspect_call will inspect the function args
        and call it with no further keyword args than it asked for.

        If the function has been decorated, it is assumed that the
        decorator preserved the function signature.
Calls a function with arguments from
        :meth:`_get_method_args`
Calls a function with arguments from : meth : _get_method_args
def _inspect_call(self, func):
        """Calls a function with arguments from
        :meth:`_get_method_args`

        Given a function, inspect_call will inspect the function args
        and call it with no further keyword args than it asked for.

        If the function has been decorated, it is assumed that the
        decorator preserved the function signature.

        """
        # Check to see if the class has a cache of argspecs yet
        try:
            cached_argspecs = self.__class__._cached_argspecs
        except AttributeError:
            self.__class__._cached_argspecs = cached_argspecs = {}

        # function could be callable
        func_key = getattr(func, 'im_func', func.__call__)
        try:
            argspec = cached_argspecs[func_key]
        except KeyError:
            argspec = cached_argspecs[func_key] = inspect.getargspec(func_key)
        kargs = self._get_method_args()

        log_debug = self._pylons_log_debug
        c = self._py_object.tmpl_context
        environ = self._py_object.request.environ
        args = None

        if argspec[2]:
            if self._py_object.config['pylons.tmpl_context_attach_args']:
                for k, val in kargs.iteritems():
                    setattr(c, k, val)
            args = kargs
        else:
            args = {}
            argnames = argspec[0][isinstance(func, types.MethodType)
                                  and 1 or 0:]
            for name in argnames:
                if name in kargs:
                    if self._py_object.config['pylons.tmpl_context_attach_args']:
                        setattr(c, name, kargs[name])
                    args[name] = kargs[name]
        if log_debug:
            log.debug("Calling %r method with keyword args: **%r",
                      func.__name__, args)
        try:
            result = self._perform_call(func, args)
        except HTTPException, httpe:
            if log_debug:
                log.debug("%r method raised HTTPException: %s (code: %s)",
                          func.__name__, httpe.__class__.__name__,
                          httpe.wsgi_response.code, exc_info=True)
            result = httpe

            # Store the exception in the environ
            environ['pylons.controller.exception'] = httpe

            # 304 Not Modified's shouldn't have a content-type set
            if result.wsgi_response.status_int == 304:
                result.wsgi_response.headers.pop('Content-Type', None)
            result._exception = True

        return result
def _inspect_call ( self , func ) : # Check to see if the class has a cache of argspecs yet try : cached_argspecs = self . __class__ . _cached_argspecs except AttributeError : self . __class__ . _cached_argspecs = cached_argspecs = { } # function could be callable func_key = getattr ( func , 'im_func' , func . __call__ ) try : argspec = cached_argspecs [ func_key ] except KeyError : argspec = cached_argspecs [ func_key ] = inspect . getargspec ( func_key ) kargs = self . _get_method_args ( ) log_debug = self . _pylons_log_debug c = self . _py_object . tmpl_context environ = self . _py_object . request . environ args = None if argspec [ 2 ] : if self . _py_object . config [ 'pylons.tmpl_context_attach_args' ] : for k , val in kargs . iteritems ( ) : setattr ( c , k , val ) args = kargs else : args = { } argnames = argspec [ 0 ] [ isinstance ( func , types . MethodType ) and 1 or 0 : ] for name in argnames : if name in kargs : if self . _py_object . config [ 'pylons.tmpl_context_attach_args' ] : setattr ( c , name , kargs [ name ] ) args [ name ] = kargs [ name ] if log_debug : log . debug ( "Calling %r method with keyword args: **%r" , func . __name__ , args ) try : result = self . _perform_call ( func , args ) except HTTPException , httpe : if log_debug : log . debug ( "%r method raised HTTPException: %s (code: %s)" , func . __name__ , httpe . __class__ . __name__ , httpe . wsgi_response . code , exc_info = True ) result = httpe # Store the exception in the environ environ [ 'pylons.controller.exception' ] = httpe # 304 Not Modified's shouldn't have a content-type set if result . wsgi_response . status_int == 304 : result . wsgi_response . headers . pop ( 'Content-Type' , None ) result . _exception = True return result