[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/ErrorReportingService/Views/Browser - EditErrorLog.py:1.2 __init__.py:1.2 configure.zcml:1.2 main.pt:1.2 showEntry.pt:1.2 showTextTBEntry.pt:1.2

Jim Fulton jim@zope.com
Wed, 23 Oct 2002 12:00:50 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/ErrorReportingService/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv8321/lib/python/Zope/App/OFS/Services/ErrorReportingService/Views/Browser

Added Files:
	EditErrorLog.py __init__.py configure.zcml main.pt 
	showEntry.pt showTextTBEntry.pt 
Log Message:
Merging in the work done by Naveen and Rakesh on the
ErrorReportingService-branch branch.

There is now an error reporting service that works like the Zope 2.6
site error log. Yay!


=== Zope3/lib/python/Zope/App/OFS/Services/ErrorReportingService/Views/Browser/EditErrorLog.py 1.1 => 1.2 ===
--- /dev/null	Wed Oct 23 12:00:50 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/ErrorReportingService/Views/Browser/EditErrorLog.py	Wed Oct 23 12:00:19 2002
@@ -0,0 +1,34 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 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.
+# 
+##############################################################################
+""" Define view component for event service control.
+
+$Id$
+"""
+
+from Zope.Publisher.Browser.BrowserView import BrowserView
+from Zope.ComponentArchitecture.ContextDependent import ContextDependent
+from Zope.App.OFS.Services.ErrorReportingService.ErrorReportingService import IErrorReportingService
+from Zope.PageTemplate.PageTemplateFile import PageTemplateFile
+from Zope.Proxy.ProxyIntrospection import removeAllProxies
+
+class EditErrorLog(BrowserView):
+    __used_for__ = IErrorReportingService
+
+    def updateProperties(self, keep_entries, copy_to_zlog=None, ignored_exceptions=None):
+        errorLog = self.context
+        if copy_to_zlog is None:
+            copy_to_zlog = 0
+        errorLog.setProperties(keep_entries, copy_to_zlog, ignored_exceptions)
+        return self.request.response.redirect('main.html')
+ 


=== Zope3/lib/python/Zope/App/OFS/Services/ErrorReportingService/Views/Browser/__init__.py 1.1 => 1.2 ===
--- /dev/null	Wed Oct 23 12:00:50 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/ErrorReportingService/Views/Browser/__init__.py	Wed Oct 23 12:00:19 2002
@@ -0,0 +1,14 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 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.
+# 
+##############################################################################
+


=== Zope3/lib/python/Zope/App/OFS/Services/ErrorReportingService/Views/Browser/configure.zcml 1.1 => 1.2 ===
--- /dev/null	Wed Oct 23 12:00:50 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/ErrorReportingService/Views/Browser/configure.zcml	Wed Oct 23 12:00:19 2002
@@ -0,0 +1,22 @@
+<zopeConfigure
+   xmlns='http://namespaces.zope.org/zope'
+   xmlns:browser='http://namespaces.zope.org/browser'
+   package="Zope.App.OFS.Services.ErrorReportingService"   
+>
+<browser:defaultView  
+	name="main.html" 
+	for=".IErrorReportingService." />
+
+<browser:view
+  for=".IErrorReportingService."
+  permission="Zope.Public"
+  factory=".Views.Browser.EditErrorLog.">
+
+  <browser:page name="main.html" template="Views/Browser/main.pt" />
+  <browser:page name="edit.html" attribute="updateProperties" />
+  <browser:page name="showEntry.html" template="Views/Browser/showEntry.pt"/>
+  <browser:page name="showTextTBEntry.html" template="Views/Browser/showTextTBEntry.pt"/>
+</browser:view>
+
+</zopeConfigure>
+ 
\ No newline at end of file


=== Zope3/lib/python/Zope/App/OFS/Services/ErrorReportingService/Views/Browser/main.pt 1.1 => 1.2 ===
--- /dev/null	Wed Oct 23 12:00:50 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/ErrorReportingService/Views/Browser/main.pt	Wed Oct 23 12:00:19 2002
@@ -0,0 +1,103 @@
+<html metal:use-macro="views/standard_macros/page">
+<head>
+  <title>View Error Log Report</title>
+</head>
+<body>
+<div metal:fill-slot="body">
+<p class="form-help">
+This page lists the exceptions that have occurred in this site
+recently.  You can configure how many exceptions should be kept
+and whether the exceptions should be copied to Zope's event log
+file(s).
+</p>
+
+<form action="edit.html" method="post">
+<br>
+<table tal:define="props context/getProperties">
+  <tr>
+    <td align="left" valign="top">
+    <div class="form-label">
+    Number of exceptions to keep
+    </div>
+    </td>
+    <td align="left" valign="top">
+    <input type="text" name="keep_entries" size="40"
+           tal:attributes="value props/keep_entries" />
+    </td>
+  </tr>
+  <tr>
+    <td align="left" valign="top">
+    <div class="form-label">
+    Copy exceptions to the event log
+    </div>
+    </td>
+    <td align="left" valign="top">
+    <input type="checkbox" name="copy_to_zlog"
+           tal:attributes="checked props/copy_to_zlog;" />
+    </td>
+  </tr>
+  <tr>
+    <td align="left" valign="top">
+    <div class="form-label">
+    Ignored exception types
+    </div>
+    </td>
+    <td align="left" valign="top">
+    <textarea name="ignored_exceptions:lines" cols="40" rows="3"
+      tal:content="python: '\n'.join(props['ignored_exceptions'])"></textarea>
+    </td>
+  </tr>
+  <tr>
+    <td align="left" valign="top">
+    </td>
+    <td align="left" valign="top">
+    <div class="form-element">
+    <input class="form-element" type="submit" name="submit" 
+     value=" Save Changes " />
+    </div>
+    </td>
+  </tr>
+</table>
+
+<h3>Exception Log (most recent first)</h3>
+
+<div tal:define="entries context/getLogEntries">
+
+<em tal:condition="not:entries">
+No exceptions logged.
+</em>
+
+<table tal:condition="entries">
+ <tr>
+  <th align="left">Time</th>
+  <th align="left">User</th>
+  <th align="left">Exception</th>
+ </tr>
+ <tr tal:repeat="entry entries">
+  <td valign="top" nowrap="nowrap">
+   <span tal:content="entry/time">Time</span>
+  </td>
+  <td>
+   <span tal:content="entry/username">joe</span>
+  </td>
+  <td valign="top">
+   <a href="showEntry" tal:attributes="href string:showEntry.html?id=${entry/id}"
+    >
+    <span tal:content="entry/type">AttributeError</span>:
+    <span tal:define="value entry/value"
+      tal:content="python: len(value) < 70 and value or value[:70] + '...'">
+      Application object has no attribute "zzope"</span>
+   </a>
+  </td>
+ </tr>
+</table>
+</div>
+</form>
+<p>
+<form action="main.html" method="GET">
+<input type="submit" name="submit" value=" Refresh " />
+</form>
+</p>
+</div>
+</body>
+</html>
\ No newline at end of file


=== Zope3/lib/python/Zope/App/OFS/Services/ErrorReportingService/Views/Browser/showEntry.pt 1.1 => 1.2 ===
--- /dev/null	Wed Oct 23 12:00:50 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/ErrorReportingService/Views/Browser/showEntry.pt	Wed Oct 23 12:00:19 2002
@@ -0,0 +1,69 @@
+<html metal:use-macro="views/standard_macros/page">
+<head>
+  <title>View Error Log Report</title>
+</head>
+<body>
+<div metal:fill-slot="body">
+<h1>Header</h1>
+<h3>Exception traceback</h3>
+<hr>
+<div tal:define="entry python:context.getLogEntryById(request.get('id'))">
+<em tal:condition="not:entry">
+The specified log entry was not found.  It may have expired.
+</em>
+
+<div tal:condition="entry">
+
+<table>
+ <tr>
+  <th align="left" valign="top">Time</th>
+    <td tal:content="entry/time">Time</td>
+ </tr>
+ <tr>
+  <th align="left" valign="top">User</th>
+  <td tal:content="entry/username">joe</td>
+ </tr>
+ <tr>
+  <th align="left" valign="top">Request URL</th>
+  <td tal:content="entry/url">http://zeomega.com</td>
+ </tr>
+ <tr>
+  <th align="left" valign="top">Exception Type</th>
+  <td tal:content="entry/type">AttributeError</td>
+ </tr>
+ <tr>
+  <th align="left" valign="top">Exception Value</th>
+  <td tal:content="entry/value">zzope</td>
+ </tr>
+</table>
+
+<div tal:condition="entry/tb_html" tal:content="structure entry/tb_html">
+Traceback (HTML)
+</div>
+
+<pre tal:condition="not:entry/tb_html" tal:content="entry/tb_text">
+Traceback (text)
+</pre>
+
+<p tal:condition="entry/tb_text"><a href="" tal:attributes="href
+   string:showTextTBEntry.html?id=${entry/id}">Display
+   traceback as text</a></p>
+
+
+
+<div tal:condition="entry/req_html">
+<h3>REQUEST</h3>
+<hr>
+<div tal:replace="structure entry/req_html"></div>
+</div>
+
+</div>
+
+<p>
+<form action="main.html" method="GET">
+<input type="submit" name="submit" value=" Return to log " />
+</form>
+</p>
+</div>
+</div>
+</html>


=== Zope3/lib/python/Zope/App/OFS/Services/ErrorReportingService/Views/Browser/showTextTBEntry.pt 1.1 => 1.2 ===
--- /dev/null	Wed Oct 23 12:00:50 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/ErrorReportingService/Views/Browser/showTextTBEntry.pt	Wed Oct 23 12:00:19 2002
@@ -0,0 +1,7 @@
+<html>
+ <div tal:define="entry python:context.getLogEntryById(request.get('id'))">
+  <pre tal:content="entry/tb_text">
+	Traceback (text)
+  </pre>
+ </div>
+</html>
\ No newline at end of file