(self, e, value)
Handler for the ``RequestSuccess`` event that is automatically
        generated after all handlers for a
        :class:`~circuits.web.events.Request` event have been invoked
        successfully.

        :param e: the successfully handled ``Request`` event (having
            as attributes the associated
            :class:`~circuits.web.wrappers.Request` and
            :class:`~circuits.web.wrappers.Response` objects).
        :param value: the value(s) returned by the invoked handler(s).

        This handler converts the value(s) returned by the
        (successfully invoked) handlers for the initial ``Request``
        event to a body and assigns it to the ``Response`` object's
        ``body`` attribute. It then fires a
        :class:`~circuits.web.events.Response` event with the
        ``Response`` object as argument.
Handler for the ``RequestSuccess`` event that is automatically
        generated after all handlers for a
        :class:`~circuits.web.events.Request` event have been invoked
        successfully.
Handler for the RequestSuccess event that is automatically generated after all handlers for a : class : ~circuits . web . events . Request event have been invoked successfully .
def _on_request_success(self, e, value):
        """
        Handler for the ``RequestSuccess`` event that is automatically
        generated after all handlers for a
        :class:`~circuits.web.events.Request` event have been invoked
        successfully.

        :param e: the successfully handled ``Request`` event (having
            as attributes the associated
            :class:`~circuits.web.wrappers.Request` and
            :class:`~circuits.web.wrappers.Response` objects).
        :param value: the value(s) returned by the invoked handler(s).

        This handler converts the value(s) returned by the
        (successfully invoked) handlers for the initial ``Request``
        event to a body and assigns it to the ``Response`` object's
        ``body`` attribute. It then fires a
        :class:`~circuits.web.events.Response` event with the
        ``Response`` object as argument.
        """
        # We only want the non-recursive value at this point.
        # If the value is an instance of Value we will set
        # the .notify flag and be notified of changes to the value.
        value = e.value.getValue(recursive=False)

        if isinstance(value, Value) and not value.promise:
            value = value.getValue(recursive=False)

        req, res = e.args[:2]

        if value is None:
            self.fire(notfound(req, res))
        elif isinstance(value, httperror):
            res.body = str(value)
            self.fire(response(res))
        elif isinstance(value, wrappers.Response):
            self.fire(response(value))
        elif isinstance(value, Value):
            if value.result and not value.errors:
                res.body = value.value
                self.fire(response(res))
            elif value.errors:
                error = value.value
                etype, evalue, traceback = error
                if isinstance(evalue, RedirectException):
                    self.fire(
                        redirect(req, res, evalue.urls, evalue.code)
                    )
                elif isinstance(evalue, HTTPException):
                    if evalue.traceback:
                        self.fire(
                            httperror(
                                req, res, evalue.code,
                                description=evalue.description,
                                error=error
                            )
                        )
                    else:
                        self.fire(
                            httperror(
                                req, res, evalue.code,
                                description=evalue.description
                            )
                        )
                else:
                    self.fire(httperror(req, res, error=error))
            else:
                # We want to be notified of changes to the value
                value = e.value.getValue(recursive=False)
                value.event = e
                value.notify = True
        elif isinstance(value, tuple):
            etype, evalue, traceback = error = value

            if isinstance(evalue, RedirectException):
                self.fire(
                    redirect(req, res, evalue.urls, evalue.code)
                )
            elif isinstance(evalue, HTTPException):
                if evalue.traceback:
                    self.fire(
                        httperror(
                            req, res, evalue.code,
                            description=evalue.description,
                            error=error
                        )
                    )
                else:
                    self.fire(
                        httperror(
                            req, res, evalue.code,
                            description=evalue.description
                        )
                    )
            else:
                self.fire(httperror(req, res, error=error))
        elif not isinstance(value, bool):
            res.body = value
            self.fire(response(res))
def _on_request_success ( self , e , value ) : # We only want the non-recursive value at this point. # If the value is an instance of Value we will set # the .notify flag and be notified of changes to the value. value = e . value . getValue ( recursive = False ) if isinstance ( value , Value ) and not value . promise : value = value . getValue ( recursive = False ) req , res = e . args [ : 2 ] if value is None : self . fire ( notfound ( req , res ) ) elif isinstance ( value , httperror ) : res . body = str ( value ) self . fire ( response ( res ) ) elif isinstance ( value , wrappers . Response ) : self . fire ( response ( value ) ) elif isinstance ( value , Value ) : if value . result and not value . errors : res . body = value . value self . fire ( response ( res ) ) elif value . errors : error = value . value etype , evalue , traceback = error if isinstance ( evalue , RedirectException ) : self . fire ( redirect ( req , res , evalue . urls , evalue . code ) ) elif isinstance ( evalue , HTTPException ) : if evalue . traceback : self . fire ( httperror ( req , res , evalue . code , description = evalue . description , error = error ) ) else : self . fire ( httperror ( req , res , evalue . code , description = evalue . description ) ) else : self . fire ( httperror ( req , res , error = error ) ) else : # We want to be notified of changes to the value value = e . value . getValue ( recursive = False ) value . event = e value . notify = True elif isinstance ( value , tuple ) : etype , evalue , traceback = error = value if isinstance ( evalue , RedirectException ) : self . fire ( redirect ( req , res , evalue . urls , evalue . code ) ) elif isinstance ( evalue , HTTPException ) : if evalue . traceback : self . fire ( httperror ( req , res , evalue . code , description = evalue . description , error = error ) ) else : self . fire ( httperror ( req , res , evalue . code , description = evalue . description ) ) else : self . fire ( httperror ( req , res , error = error ) ) elif not isinstance ( value , bool ) : res . body = value self . fire ( response ( res ) )