Re: [Zope-dev] Using views for exceptions in Zope 2.12?
Laurence Rowe wrote: Sidnei da Silva wrote: On Sat, May 9, 2009 at 12:52 PM, Chris Withers ch...@simplistix.co.uk wrote: Hmm, so I would I register different views for a KeyError versus an AttributeError? I believe you need to make KeyError implement an interface to be able to register a view for it. What use would be a view for KeyError anyway. *wink* It's perfectly possible to register a view for a class instead of an interface. That's exactly what I did, but my view wasn't used. Why is that? What magic is making view lookup for exceptions behave differently from normal view lookups? Chris ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Using views for exceptions in Zope 2.12?
Sidnei da Silva wrote: On Sat, May 9, 2009 at 12:52 PM, Chris Withers ch...@simplistix.co.uk wrote: Hmm, so I would I register different views for a KeyError versus an AttributeError? I believe you need to make KeyError implement an interface to be able to register a view for it. What use would be a view for KeyError anyway. *wink* It's perfectly possible to register a view for a class instead of an interface. (Not that I am familiar with the new views for errors stuff). Laurence ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Using views for exceptions in Zope 2.12?
On May 9, 2009, at 11:52 AM, Chris Withers wrote: Hanno Schlichting wrote: Try following the description given in the changelog at http://svn.zope.org/Zope/branches/2.11/doc/CHANGES.txt?view=markup under Zope 3-based exception views. Hmm, so I would I register different views for a KeyError versus an AttributeError? Not unless you actually need different views for them, which you probably don't. In my experience, you only need a few, as described in change notes. One additional one that isn't mentioned in the change notes but that I use a lot is UserError (zope.exceptions.UserError). This is an exception to raise when you want to display an end-user error message. Most exceptions are really application errors and should be handled by a view for Exception that displays a system error message. Jim -- Jim Fulton Zope Corporation ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Using views for exceptions in Zope 2.12?
Hanno Schlichting wrote: Try following the description given in the changelog at http://svn.zope.org/Zope/branches/2.11/doc/CHANGES.txt?view=markup under Zope 3-based exception views. Hmm, so I would I register different views for a KeyError versus an AttributeError? cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Using views for exceptions in Zope 2.12?
On Sat, May 9, 2009 at 12:52 PM, Chris Withers ch...@simplistix.co.uk wrote: Hmm, so I would I register different views for a KeyError versus an AttributeError? I believe you need to make KeyError implement an interface to be able to register a view for it. What use would be a view for KeyError anyway. *wink* -- Sidnei da Silva Canonical Ltd. Landscape · Changing the way you manage your systems http://landscape.canonical.com ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Using views for exceptions in Zope 2.12?
Chris Withers wrote: Given that the source of bug #372632 appears to be code related to allowing views on exceptions in Zope 2, I thought I'd try use this method. Try following the description given in the changelog at http://svn.zope.org/Zope/branches/2.11/doc/CHANGES.txt?view=markup under Zope 3-based exception views. Hanno ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Using views for exceptions in Zope 2.12?
Hi All, Given that the source of bug #372632 appears to be code related to allowing views on exceptions in Zope 2, I thought I'd try use this method. I tried this, without much joy: browser:defaultView for=exceptions.Exception name=error / browser:page for=exceptions.Exception template=html/error.html name=error permission=zope2.Public / So, how should I be wiring in views for exceptions? Also, is there a base view class for exceptions anywhere that provides the following or their equivalents? kwargs = {'error_type': error_name, 'error_value': error_value, 'error_tb': error_tb, 'error_traceback': error_tb, 'error_message': error_message, 'error_log_url': error_log_url} Finally, when a view is used to render and exception, is the userthe current logged in user (as is the case with standard_error_message) or Anonymous (as has annoyingly been the case with Unauthorized exceptions in the past) cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )