[Zope3-checkins] CVS: Zope3/src/zope/app/browser/index/field - configure.zcml:1.2 control.pt:1.2 control.py:1.2

Marius Gedminas mgedmin@codeworks.lt
Mon, 23 Jun 2003 12:45:08 -0400


Update of /cvs-repository/Zope3/src/zope/app/browser/index/field
In directory cvs.zope.org:/tmp/cvs-serv9136/src/zope/app/browser/index/field

Modified Files:
	configure.zcml control.pt control.py 
Log Message:
FieldIndex now can adapt objects to a specific interface before indexing them.
For example, now you can create an index that adapts objects to IZopeDublinCore
and indexes their 'title' attributes.



=== Zope3/src/zope/app/browser/index/field/configure.zcml 1.1 => 1.2 ===
--- Zope3/src/zope/app/browser/index/field/configure.zcml:1.1	Sun Jun 22 12:10:55 2003
+++ Zope3/src/zope/app/browser/index/field/configure.zcml	Mon Jun 23 12:44:38 2003
@@ -10,6 +10,7 @@
     permission="zope.ManageServices"
     content_factory="zope.app.index.field.index.FieldIndex"
     arguments="field_name"
+    keyword_arguments="interface"
     />
 
   <browser:page


=== Zope3/src/zope/app/browser/index/field/control.pt 1.1 => 1.2 ===
--- Zope3/src/zope/app/browser/index/field/control.pt:1.1	Sun Jun 22 12:10:55 2003
+++ Zope3/src/zope/app/browser/index/field/control.pt	Mon Jun 23 12:44:38 2003
@@ -28,6 +28,13 @@
         Successfully unsubscribed.
     </span>
 
+    <div tal:condition="context/interface">
+        Adapting objects to: <span tal:replace="view/interface_name" />
+    </div>
+    <div>
+        Indexing on attribute: <span tal:replace="context/field_name" />
+    </div>
+
     <div>
         Documents: <span tal:replace="context/documentCount" />
     </div>


=== Zope3/src/zope/app/browser/index/field/control.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/browser/index/field/control.py:1.1	Sun Jun 22 12:10:55 2003
+++ Zope3/src/zope/app/browser/index/field/control.py	Mon Jun 23 12:44:38 2003
@@ -29,6 +29,7 @@
 from zope.app.traversing import canonicalPath
 from zope.app.interfaces.dublincore import IZopeDublinCore
 from zope.app.interfaces.index.text import IQueryView
+from zope.app.browser.component.interfacewidget import interfaceToName
 
 class ControlView(BrowserView):
 
@@ -37,6 +38,9 @@
     def __init__(self, context, request):
         super(ControlView, self).__init__(context, request)
         self.hub = getService(context, HubIds)
+
+    def interface_name(self):
+        return interfaceToName(self.context.interface)
 
     def query(self):
         queryText = self.request.get('queryText', '')