[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/uniqueid/browser/ fix registered object view (UniqueIdUtility/@@index.html):

Dominik Huber dominik.huber at projekt01.ch
Wed Nov 10 16:35:31 EST 2004


Log message for revision 28423:
  fix registered object view (UniqueIdUtility/@@index.html):
  - deletion of nested objects is leading 
    to orphan object references (parentless).
  - their contexts and therefore their paths can
    not be evaluated which was leading to an error.

Changed:
  U   Zope3/trunk/src/zope/app/uniqueid/browser/__init__.py
  U   Zope3/trunk/src/zope/app/uniqueid/browser/registrations.pt

-=-
Modified: Zope3/trunk/src/zope/app/uniqueid/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/uniqueid/browser/__init__.py	2004-11-10 20:52:18 UTC (rev 28422)
+++ Zope3/trunk/src/zope/app/uniqueid/browser/__init__.py	2004-11-10 21:35:30 UTC (rev 28423)
@@ -18,6 +18,14 @@
 from zope.security.proxy import removeSecurityProxy
 from zope.app import zapi
 
+
+def saveGetPath(obj):
+    try:
+        return zapi.getPath(obj)
+    except:
+        return None
+    
+
 class UniqueIdUtilityView(object):
 
     def len(self):
@@ -29,6 +37,5 @@
         self.context.register(zapi.traverse(self.context, "/++etc++site"))
         self.request.response.redirect('index.html')
 
-    def items(self):
-        return [(uid, zapi.getPath(ref())) for uid, ref in self.context.items()]
-
+    def items(self):  
+        return [(uid, saveGetPath(ref())) for uid, ref in self.context.items()]

Modified: Zope3/trunk/src/zope/app/uniqueid/browser/registrations.pt
===================================================================
--- Zope3/trunk/src/zope/app/uniqueid/browser/registrations.pt	2004-11-10 20:52:18 UTC (rev 28422)
+++ Zope3/trunk/src/zope/app/uniqueid/browser/registrations.pt	2004-11-10 21:35:30 UTC (rev 28423)
@@ -9,7 +9,7 @@
 	<tr><th i18n:translate="">ID</th><th i18n:translate="">Object</th></tr>
 	<tr tal:repeat="row view/items">
 	  <td tal:content="python:row[0]" />
-	  <td><a tal:content="python:row[1]" tal:attributes="href python:row[1]"/></td>
+	  <td><a tal:content="python:row[1] or default" tal:attributes="href python:row[1]">orphan</a></td>
 	</tr>
       </table>
   </div>



More information about the Zope3-Checkins mailing list