We worked this out on IRC.  Conclusion: the patch is just about right.  We 
decided to make the following tweaks:

- Allow route-specific exception views.

- Don't use ZCML to register the default exception views (instead, do that in 
Configurator.setup_registry).

- No new ZCML directives of configurator APIs are necessary, but we need to 
make set_notfound_view and set_forbidden_view continue to work.

- C


On 4/1/10 9:29 AM, Andrey Popp wrote:
> Sorry, I forgot to attach patch.
>
> On Thu, Apr 1, 2010 at 5:28 PM, Andrey Popp<8may...@gmail.com>  wrote:
>> Hello,
>>
>> I have a preview for exception views functionality.
>>
>> I've refactored Router to handle exceptions via IView lookups on
>> IRequest, Exception class. That means all exception views should be
>> global (not belongs to specific route) and exception views can be
>> clashed with ordinary views.
>>
>> Forbidden and NotFound views are special case of exception views now.
>> Default views for that exceptions are registered via
>> repoze.bfg.includes/configure.zcml.
>>
>> All tests are pass, 5 tests cases was removed and 7 new was added.
>>
>> If you like it, I will make other changes related to exception views
>> configuration (possibly add methods to Configurator API and new ZCML
>> directive?).
>>
>> Thanks.
>>
>> On Fri, Mar 12, 2010 at 5:27 AM, Chris McDonough<chr...@plope.com>  wrote:
>>> On 3/10/10 9:59 AM, Andrey Popp wrote:
>>>>>
>>>>> The context of such an "exception view" will be the exception instance
>>>>> itself.  If you want a particular exception to be able to use a "real"
>>>>> context, you'll make it available as an attribute of the exception for
>>>>> use
>>>>> by the registered exception view (e.g. context.context or so).
>>>>
>>>> Thanks, this is that I was talking about. Will try to implement.
>>>>
>>>
>>> Great.  This would be an excellent feature to have.
>>>
>>> --
>>> Chris McDonough
>>> Agendaless Consulting, Fredericksburg VA
>>> The repoze.bfg Web Application Framework Book: http://bfg.repoze.org/book
>>>
>>
>>
>>
>> --
>> Andrey Popp
>>
>> phone: +7 911 740 24 91
>> e-mail: 8may...@gmail.com
>>
>
>
>


-- 
Chris McDonough
Agendaless Consulting, Fredericksburg VA
The repoze.bfg Web Application Framework Book: http://bfg.repoze.org/book
_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to