[Zope3-checkins] CVS: Zope3/src/zope/app/browser/exception - user.pt:1.1 user.py:1.1 configure.zcml:1.2

Jim Fulton jim@zope.com
Fri, 7 Mar 2003 07:06:43 -0500


Update of /cvs-repository/Zope3/src/zope/app/browser/exception
In directory cvs.zope.org:/tmp/cvs-serv4990/src/zope/app/browser/exception

Modified Files:
	configure.zcml 
Added Files:
	user.pt user.py 
Log Message:
Added simpe UserError exceptions and a view for displaying them.
UserErrors should be raised when a user has made an error. UserErrors
will, generally, not be caught and handled by software, but will be
displayed to the user.

The currentl view just displays the arguments passed to the error as a
single paragraph, which should be fine for small error messages.

There are lots of ways we might expand on this eventually.


=== Added File Zope3/src/zope/app/browser/exception/user.pt ===
<html metal:use-macro="context/@@standard_macros/dialog">
<body>

<div metal:fill-slot="body">

<h1 tal:content="view/title">Error type</h1>
<p>
<span tal:repeat="part context"><span tal:replace="part">Error message</span>
</span>
</p>

</div>
</body>
</html>


=== Added File Zope3/src/zope/app/browser/exception/user.py ===
##############################################################################
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
##############################################################################
"""Support for user views

$Id: user.py,v 1.1 2003/03/07 12:06:40 jim Exp $
"""
__metaclass__ = type

class UserErrorView:

    def title(self):
        return self.context.__class__.__name__

    


=== Zope3/src/zope/app/browser/exception/configure.zcml 1.1 => 1.2 ===
--- Zope3/src/zope/app/browser/exception/configure.zcml:1.1	Wed Feb  5 06:34:53 2003
+++ Zope3/src/zope/app/browser/exception/configure.zcml	Fri Mar  7 07:06:40 2003
@@ -1,16 +1,19 @@
 <zopeConfigure xmlns="http://namespaces.zope.org/browser">
 
-<defaultView 
-    for="zope.exceptions.IUnauthorized"
-    name="exception"
-    />
-
 <page
     for="zope.exceptions.IUnauthorized"
-    name="exception"
+    name="index.html"
     permission="zope.Public"
     template="unauthorized.pt"
     class=".unauthorized.Unauthorized"
+    />
+
+<page
+    for="zope.app.interfaces.exceptions.IUserError"
+    name="index.html"
+    permission="zope.Public"
+    template="user.pt"
+    class=".user.UserErrorView"
     />
 
 </zopeConfigure>