Ian Bicking <[EMAIL PROTECTED]> writes:

> You have to hook into what errormiddleware calls,
> paste.exceptions.errormiddleware.handle_exception.  It would be nice
> if there was something in the environment that was hooked into the
> configuration, but there isn't now, so you'll have to provide all
> the many arguments to that function.

I have the mails working with:

    from paste.exceptions import collector, reporter
    from pylons.error import HTMLFormatter
    class DetailedReporter(reporter.EmailReporter):
        def format_html(self, exc_data, **kw):
            fmt = HTMLFormatter(show_extra_data=True)
            fragment, code = fmt.format_collected_data(exc_data)
            return base + fragment

    from paste.exceptions.errormiddleware import handle_exception, send_report
    from paste.exceptions import formatter
    import sys

    def email_backtrace():
        exc_info = sys.exc_info()
        exc_data = collector.collect_exception(*exc_info)

        rep = DetailedReporter(
            to_addresses=config["webmaster_email"],
            from_address=config["error_email_from"],
            smtp_server=config["smtp_server"],
            subject_prefix="WebApp Error: ")

        rep_err = send_report(rep, exc_data)

        if rep_err:
            raise
        return

>From anywhere in the code I can do

  h.email_backtrace()

to send a backtrace to the webmaster without aborting the request, but
I do not get the request variables in the mail, only the backtrace.

Any idea?

-- 
Yannick Gingras

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to