[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Container/Find/Views/Browser - Find.py:1.1.2.2 find.pt:1.1.2.2

Martijn Faassen m.faassen@vet.uu.nl
Tue, 9 Apr 2002 12:39:43 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Container/Find/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv13256/App/OFS/Container/Find/Views/Browser

Modified Files:
      Tag: Zope-3x-branch
	Find.py find.pt 
Log Message:
Use new 'url' view to get absolute_url so you can actually click on links
now. 


=== Zope3/lib/python/Zope/App/OFS/Container/Find/Views/Browser/Find.py 1.1.2.1 => 1.1.2.2 ===
 from Zope.App.OFS.Container.Find.FindAdapter import SimpleIdFindFilter
 
-from Zope.ComponentArchitecture import getAdapter
+from Zope.ComponentArchitecture import getAdapter, getRequestView
 
 # XXX very simple implementation right now
 class Find(AttributePublisher):
@@ -35,6 +35,9 @@
     
     index = PageTemplateFile('find.pt')
 
+    def setViewRequest(self, request):
+        self._request = request
+        
     def findByIds(self, ids):
         """Do a find for the ids listed in ids, which is a string.
         """
@@ -43,9 +46,14 @@
         # if we don't have any ids listed, don't search at all
         if not ids:
             return []
-        found = finder.find([SimpleIdFindFilter(ids)])
-        return [getId(object) for object in found]
-
+        request = self._request
+        result = []
+        for object in finder.find([SimpleIdFindFilter(ids)]):
+            id = getId(object)
+            url = str(getRequestView(object, 'url', request))
+            result.append({ 'id': id, 'url': url})
+        return result
+    
 from Zope.ContextWrapper import getdict
 
 # XXX get the id of an object (should be imported from somewhere)


=== Zope3/lib/python/Zope/App/OFS/Container/Find/Views/Browser/find.pt 1.1.2.1 => 1.1.2.2 ===
 </form>
 <table tal:condition="request/ids | nothing">
-<tr tal:repeat="id python:view.findByIds(request['ids'])">
-<td tal:content="id">id</td>
+<tr tal:repeat="item python:view.findByIds(request['ids'])">
+<td><a href="" tal:attributes="href item/url" tal:content="item/id">id</a></td>
 </tr>
 </table>
 </div>