Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Exceptions thrown in NewRequest subscriber don't get caught by pyramid_debugtoolbar
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Wyatt Baldwin  
View profile  
 More options Feb 13, 1:45 pm
From: Wyatt Baldwin <wyatt.lee.bald...@gmail.com>
Date: Wed, 13 Feb 2013 10:45:47 -0800 (PST)
Local: Wed, Feb 13 2013 1:45 pm
Subject: Exceptions thrown in NewRequest subscriber don't get caught by pyramid_debugtoolbar

I have a NewRequest subscriber that's added in main() via
config.add_subscriber(). Exceptions thrown in this subscriber aren't caught
by pyramid_debugtoolbar. Is this behavior expected?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Merickel  
View profile  
 More options Feb 13, 2:15 pm
From: Michael Merickel <mmeri...@gmail.com>
Date: Wed, 13 Feb 2013 13:15:48 -0600
Local: Wed, Feb 13 2013 2:15 pm
Subject: Re: Exceptions thrown in NewRequest subscriber don't get caught by pyramid_debugtoolbar

Without more info I can say it's not expected on anything after Pyramid 1.0
where NewRequest subscribers explicitly did not support exceptions.

On Wed, Feb 13, 2013 at 12:45 PM, Wyatt Baldwin <wyatt.lee.bald...@gmail.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Wyatt Baldwin  
View profile  
 More options Feb 13, 4:40 pm
From: Wyatt Baldwin <wyatt.lee.bald...@gmail.com>
Date: Wed, 13 Feb 2013 13:40:00 -0800 (PST)
Subject: Re: Exceptions thrown in NewRequest subscriber don't get caught by pyramid_debugtoolbar

I'm using Pyramid 1.4. pyramid_debugtoolbar is included via the
pyramid.includes settings. I'm not using any other includes or tweens. The
subscriber is set up like this:

def main(global_config, *settings):
    config = Configurator(settings=settings)
    def callback(event):
        """Exceptions raised here are not caught by pyramid_debugtoolbar"""
    config.add_subscriber(callback, NewRequest)
    app = config.make_wsgi_app()
    return app


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Wyatt Baldwin  
View profile  
 More options Feb 13, 5:25 pm
From: Wyatt Baldwin <wyatt.lee.bald...@gmail.com>
Date: Wed, 13 Feb 2013 14:25:02 -0800 (PST)
Local: Wed, Feb 13 2013 5:25 pm
Subject: Re: Exceptions thrown in NewRequest subscriber don't get caught by pyramid_debugtoolbar

I created a minimal test case. The exception raised by the view is caught
by pyramid_debugtoolbar. The exception raised by the NewRequest callback is
caught but isn't displayed correctly because requests to /_debug_toolbar/*
hit the same exception.

I can fix this by returning early from the callback if PATH_INFO starts
with /_debug_toolbar, but maybe there's a better way.

But this is a bit different from what I'm seeing in my actual app, which is
that the exeption doesn't appear to be caught at all. More investigation
under way...

from waitress import serve

from pyramid.config import Configurator
from pyramid.events import NewRequest

def main(global_config, **settings):
    settings['pyramid.includes'] = ['pyramid_debugtoolbar']
    config = Configurator(settings=settings)
    def callback(event):
        something()
    #config.add_subscriber(callback, NewRequest)
    config.add_route('route', '/route')
    config.add_view(view, route_name='route', renderer='string')
    app = config.make_wsgi_app()
    return app

def view(request):
    return xxx

def something():
    raise Exception

if __name__ == '__main__':
    app = main({})
    serve(app)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Merickel  
View profile  
 More options Feb 13, 7:00 pm
From: Michael Merickel <mmeri...@gmail.com>
Date: Wed, 13 Feb 2013 18:00:22 -0600
Local: Wed, Feb 13 2013 7:00 pm
Subject: Re: Exceptions thrown in NewRequest subscriber don't get caught by pyramid_debugtoolbar

Oh.. that.. yeah. Without providing any useful information, I can just say
that I tend to avoid NewRequest subscribers like the plague now that
config.add_request_method exists.

This sounds like a more fundamental issue with the toolbar. It historically
causes all sorts of odd problems that some of its urls are handled within
your Pyramid application.

On Wed, Feb 13, 2013 at 4:25 PM, Wyatt Baldwin
<wyatt.lee.bald...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »