On Tue, 2011-08-30 at 11:23 -0700, Bruce Wade wrote:
> Please see the attached screen shots. There is no useful information
> in the console to help debug this example issue. I believe older
> versions of pyramid would have displayed more information. Unless we
> are missing a configuration to display more information.
> 

I see.  You can do one of these things for now:

a) add pyramid_exclog to your configuration.  E.g. install
   pyramid_exclog using easy_install or make it a dependency in 
   your project's setup.py, then add it to the "pyramid.includes"
   line in your development.ini:

      pyramid.includes = pyramid_debugtoolbar
                         pyramid_exclog

   All tracebacks will be then logged to the console.

b) Turn off the debugtoolbar exception handler by adding the following
   line to your application's settings in development.ini:

      debugtoolbar.intercept_exc = false

   After this is done, the toolbar will still be present on HTML
   pages and you'll still be able to use its "panel" features
   (like profile, show SQLA results, etc), but when an exception is
   raised, the toolbar exception handler won't catch the exception;
   instead a traceback will be printed to the console and you'll see
   a much rawer error message in the browser.

Thanks for bringing this up.  I may reconsider how we set up the
scaffolds or change pyramid_debugtoolbar in light of the fact that I
think we want tracebacks to go to the console regardless of whether
they're also shown in the debugger.

- C


> 
> Code from the controller: 
> @view_config(route_name='saverating', renderer='json',
> request_method='POST')
> def save_rating(request):
>     data = json.loads(request.params['data'])
>     ads_for_member =
> DBSession.query(ViewedAds).filter_by(date=datetime.date.today()).first()
>     member_urls_today = cPickle.loads(str(ads_for_member.adsviewed))
>     
>     # This next line is what is causing the error because data['id']
> == u'1' if changed to int(data['id']) there is no error
>     # This is just an example with this error on purpose :D
>     print "URLS: ", member_urls_today[data['id']]
>     # The above line is causing the POST
> http://127.0.0.1:6543/ajax/save/rating/ 500 (Internal Server Error)
>     
>     member_urls_today[int(data['id'])-1] = data
>     ads_for_member.adsviewed = cPickle.dumps(member_urls_today)
>     ads_for_member.total_viewed += 1
>     DBSession.add(ads_for_member)
>     return {'ads_viewed_today':ads_for_member.total_viewed}
> 
> 
> 
> 
> 
> On Tue, Aug 30, 2011 at 10:52 AM, Chris McDonough <chr...@plope.com>
> wrote:
>         On Tue, 2011-08-30 at 10:46 -0700, Bruce Wade wrote:
>         > Trace back works great until there is a 500 error, like
>         trying to
>         > using a Unicode number to an index for a list. If the
>         renderer wasn't
>         > set to json the error would be displayed however when the
>         renderer is
>         > json there is no message to trace, and the js console only
>         says 500
>         > server error.
>         
>         
>         This is actually not quite true, at least as I understand what
>         you're
>         saying.  The console used to start Pyramid will display a
>         Python
>         traceback regardless of whether the content type is JSON or
>         not, or at
>         least can be configured to do so.  If you're saying your
>         developers put
>         Pyramid "in the background" when developing (via e.g.
>         supervisor or
>         paster serve --daemon) and therefore they don't see a
>         traceback, you
>         might instead choose to run it in the foreground.
>         
>         But maybe I'm misunderstanding.
>         
>         
>         - C
>         
>         >
>         > On Tue, Aug 30, 2011 at 10:31 AM, Chris McDonough
>         <chr...@plope.com>
>         > wrote:
>         >         On Tue, 2011-08-30 at 10:25 -0700, Bruce Wade wrote:
>         >         > OK Thanks, we like the debug tool bar so we will
>         have to see
>         >         how our
>         >         > team can change things to make it easier debugging
>         view
>         >         errors when
>         >         > using ajax.
>         >
>         >
>         >         FWIW, personally, I just use the traceback output on
>         the
>         >         console.
>         >         There's also a pyramid_exclog package on PyPI that
>         you can use
>         >         to log
>         >         (or even email) exceptions.  See
>         >
>         https://docs.pylonsproject.org/projects/pyramid_exclog/dev/
>         >
>         >         - C
>         >
>         >
>         >
>         >         >
>         >         >
>         >         >
>         >         > On Tue, Aug 30, 2011 at 10:19 AM, Chris McDonough
>         >         <chr...@plope.com>
>         >         > wrote:
>         >         >         On Tue, 2011-08-30 at 10:18 -0700, Bruce
>         Wade wrote:
>         >         >         > Thank you for your response at least I
>         know I am
>         >         not loosing
>         >         >         my
>         >         >         > mind :D.
>         >         >         >
>         >         >         >
>         >         >         > Is there any plans on getting ajax/json
>         support
>         >         into the
>         >         >         debug
>         >         >         > toolbar?
>         >         >
>         >         >
>         >         >         No.
>         >         >
>         >         >         - C
>         >         >
>         >         >
>         >         >
>         >         >         >
>         >         >         >
>         >         >         > --
>         >         >         > Bruce
>         >         >         >
>         >         >         > On Tue, Aug 30, 2011 at 10:06 AM, Chris
>         McDonough
>         >         >         <chr...@plope.com>
>         >         >         > wrote:
>         >         >         >         On Tue, 2011-08-30 at 09:55
>         -0700, Bruce
>         >         Wade wrote:
>         >         >         >         > Hello,
>         >         >         >         >
>         >         >         >         >
>         >         >         >         > I noticed a change in how
>         paster is
>         >         handling
>         >         >         errors. Prior
>         >         >         >         to v1.2a3
>         >         >         >         > when I used renderer='json'
>         and I had a
>         >         500 server
>         >         >         error the
>         >         >         >         console
>         >         >         >         > window would provide me with
>         the debug
>         >         URL to
>         >         >         check out.
>         >         >         >         However now
>         >         >         >         > there is no URL displayed with
>         I get an
>         >         error. How
>         >         >         do we
>         >         >         >         troubleshoot
>         >         >         >         > the errors when using ajax if
>         there is
>         >         no debug
>         >         >         url anymore?
>         >         >         >         Or is
>         >         >         >         > there a new way with the
>         latest pyramid
>         >         to view
>         >         >         the debug
>         >         >         >         info now?
>         >         >         >
>         >         >         >
>         >         >         >         This was a feature of WebError.
>          The new
>         >         debugger
>         >         >         doesn't have
>         >         >         >         this
>         >         >         >         feature, unfortunately, and
>         there are no
>         >         plans to
>         >         >         add it.  If
>         >         >         >         you want
>         >         >         >         the feature back, you can change
>         your
>         >         project to
>         >         >         depend on the
>         >         >         >         WebError
>         >         >         >         distribution, change your
>         development.ini
>         >         to include
>         >         >         it in a
>         >         >         >         pipeline,
>         >         >         >         and disable the debug toolbar.
>         >         >         >
>         >         >         >         - C
>         >         >         >
>         >         >         >
>         >         >         >
>         >         >         >         --
>         >         >         >         You received this message
>         because you are
>         >         subscribed
>         >         >         to the
>         >         >         >         Google Groups "pylons-discuss"
>         group.
>         >         >         >         To post to this group, send
>         email to
>         >         >         >         pylons-discuss@googlegroups.com.
>         >         >         >         To unsubscribe from this group,
>         send email
>         >         to
>         >         >         pylons-discuss
>         >         >         >         +unsubscr...@googlegroups.com.
>         >         >         >         For more options, visit this
>         group at
>         >         >         >
>         >         http://groups.google.com/group/pylons-discuss?hl=en.
>         >         >         >
>         >         >         >
>         >         >         >
>         >         >         >
>         >         >         >
>         >         >         > --
>         >         >         > --
>         >         >         > Regards,
>         >         >         > Bruce Wade
>         >         >         > http://ca.linkedin.com/in/brucelwade
>         >         >         > http://www.wadecybertech.com
>         >         >         > http://www.warplydesigned.com
>         >         >         > http://www.fitnessfriendsfinder.com
>         >         >         >
>         >         >         >
>         >         >
>         >         >         > --
>         >         >
>         >         >         > You received this message because you
>         are
>         >         subscribed to the
>         >         >         Google
>         >         >         > Groups "pylons-discuss" group.
>         >         >         > To post to this group, send email to
>         >         >         pylons-discuss@googlegroups.com.
>         >         >         > To unsubscribe from this group, send
>         email to
>         >         pylons-discuss
>         >         >         > +unsubscr...@googlegroups.com.
>         >         >         > For more options, visit this group at
>         >         >         >
>         >         http://groups.google.com/group/pylons-discuss?hl=en.
>         >         >
>         >         >
>         >         >         --
>         >         >         You received this message because you are
>         subscribed
>         >         to the
>         >         >         Google Groups "pylons-discuss" group.
>         >         >         To post to this group, send email to
>         >         >         pylons-discuss@googlegroups.com.
>         >         >         To unsubscribe from this group, send email
>         to
>         >         pylons-discuss
>         >         >         +unsubscr...@googlegroups.com.
>         >         >         For more options, visit this group at
>         >         >
>         http://groups.google.com/group/pylons-discuss?hl=en.
>         >         >
>         >         >
>         >         >
>         >         >
>         >         >
>         >         >
>         >         > --
>         >         > --
>         >         > Regards,
>         >         > Bruce Wade
>         >         > http://ca.linkedin.com/in/brucelwade
>         >         > http://www.wadecybertech.com
>         >         > http://www.warplydesigned.com
>         >         > http://www.fitnessfriendsfinder.com
>         >         >
>         >         >
>         >
>         >         > --
>         >
>         >         > You received this message because you are
>         subscribed to the
>         >         Google
>         >         > Groups "pylons-discuss" group.
>         >         > To post to this group, send email to
>         >         pylons-discuss@googlegroups.com.
>         >         > To unsubscribe from this group, send email to
>         pylons-discuss
>         >         > +unsubscr...@googlegroups.com.
>         >         > For more options, visit this group at
>         >         >
>         http://groups.google.com/group/pylons-discuss?hl=en.
>         >
>         >
>         >         --
>         >         You received this message because you are subscribed
>         to the
>         >         Google Groups "pylons-discuss" group.
>         >         To post to this group, send email to
>         >         pylons-discuss@googlegroups.com.
>         >         To unsubscribe from this group, send email to
>         pylons-discuss
>         >         +unsubscr...@googlegroups.com.
>         >         For more options, visit this group at
>         >         http://groups.google.com/group/pylons-discuss?hl=en.
>         >
>         >
>         >
>         >
>         >
>         >
>         > --
>         > --
>         > Regards,
>         > Bruce Wade
>         > http://ca.linkedin.com/in/brucelwade
>         > http://www.wadecybertech.com
>         > http://www.warplydesigned.com
>         > http://www.fitnessfriendsfinder.com
>         >
>         >
>         
>         > --
>         
>         > You received this message because you are subscribed to the
>         Google
>         > Groups "pylons-discuss" group.
>         > To post to this group, send email to
>         pylons-discuss@googlegroups.com.
>         > To unsubscribe from this group, send email to pylons-discuss
>         > +unsubscr...@googlegroups.com.
>         > For more options, visit this group at
>         > http://groups.google.com/group/pylons-discuss?hl=en.
>         
>         
>         --
>         You received this message because you are subscribed to the
>         Google Groups "pylons-discuss" group.
>         To post to this group, send email to
>         pylons-discuss@googlegroups.com.
>         To unsubscribe from this group, send email to pylons-discuss
>         +unsubscr...@googlegroups.com.
>         For more options, visit this group at
>         http://groups.google.com/group/pylons-discuss?hl=en.
>         
>         
> 
> 
> 
> 
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.warplydesigned.com
> http://www.fitnessfriendsfinder.com
> 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "pylons-discuss" group.
> To post to this group, send email to pylons-discuss@googlegroups.com.
> To unsubscribe from this group, send email to pylons-discuss
> +unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/pylons-discuss?hl=en.


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

Reply via email to