[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/file/ Factored the file text-indexing support into a separately-distributed

Jim Fulton jim at zope.com
Sun May 23 16:29:26 EDT 2004


Log message for revision 24913:
Factored the file text-indexing support into a separately-distributed
package. 




-=-
Modified: Zope3/trunk/src/zope/app/file/DEPENDENCIES.cfg
===================================================================
--- Zope3/trunk/src/zope/app/file/DEPENDENCIES.cfg	2004-05-23 19:28:22 UTC (rev 24912)
+++ Zope3/trunk/src/zope/app/file/DEPENDENCIES.cfg	2004-05-23 20:29:25 UTC (rev 24913)
@@ -1,7 +1,6 @@
 persistent
 transaction
 zope.app
-zope.app.index
 zope.app.onlinehelp
 zope.fssync
 zope.interface

Modified: Zope3/trunk/src/zope/app/file/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/file/configure.zcml	2004-05-23 19:28:22 UTC (rev 24912)
+++ Zope3/trunk/src/zope/app/file/configure.zcml	2004-05-23 20:29:25 UTC (rev 24913)
@@ -92,12 +92,6 @@
       permission="zope.ManageContent"
       />
 
-  <adapter
-      for=".interfaces.IFile"
-      provides="zope.app.index.interfaces.text.ISearchableText"
-      factory=".file.SearchableText"
-      />
-
   <fssync:adapter
       class=".file.File"
       factory=".fssync.FileAdapter"

Modified: Zope3/trunk/src/zope/app/file/file.py
===================================================================
--- Zope3/trunk/src/zope/app/file/file.py	2004-05-23 19:28:22 UTC (rev 24912)
+++ Zope3/trunk/src/zope/app/file/file.py	2004-05-23 20:29:25 UTC (rev 24913)
@@ -20,7 +20,6 @@
 from zope.interface import implements
 
 from zope.publisher.browser import FileUpload
-from zope.app.index.interfaces.text import ISearchableText
 from interfaces import IFile, IFileContent
 
 # set the size of the chunks
@@ -216,22 +215,6 @@
     data = property(_getData, _setData)
 
 
-class SearchableText(object):
-    """Make File objects searchable."""
-
-    implements(ISearchableText)
-    __used_for__ = IFile
-
-    def __init__(self, file):
-        self.file = file
-
-    def getSearchableText(self):
-        if self.file.contentType == "text/plain":
-            return [unicode(self.file.data)]
-        else:
-            return None
-
-
 class FileChunk(Persistent):
     # Wrapper for possibly large data
 

Copied: Zope3/trunk/src/zope/app/file/textindex/DEPENDENCIES.cfg (from rev 24906, Zope3/trunk/src/zope/app/file/DEPENDENCIES.cfg)
===================================================================
--- Zope3/trunk/src/zope/app/file/DEPENDENCIES.cfg	2004-05-23 16:21:33 UTC (rev 24906)
+++ Zope3/trunk/src/zope/app/file/textindex/DEPENDENCIES.cfg	2004-05-23 20:29:25 UTC (rev 24913)
@@ -0,0 +1 @@
+zope.app.index

Copied: Zope3/trunk/src/zope/app/file/textindex/SETUP.cfg (from rev 24906, Zope3/trunk/src/zope/app/file/SETUP.cfg)

Added: Zope3/trunk/src/zope/app/file/textindex/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/file/textindex/__init__.py	2004-05-23 19:28:22 UTC (rev 24912)
+++ Zope3/trunk/src/zope/app/file/textindex/__init__.py	2004-05-23 20:29:25 UTC (rev 24913)
@@ -0,0 +1 @@
+#


Property changes on: Zope3/trunk/src/zope/app/file/textindex/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Copied: Zope3/trunk/src/zope/app/file/textindex/configure.zcml (from rev 24906, Zope3/trunk/src/zope/app/file/configure.zcml)
===================================================================
--- Zope3/trunk/src/zope/app/file/configure.zcml	2004-05-23 16:21:33 UTC (rev 24906)
+++ Zope3/trunk/src/zope/app/file/textindex/configure.zcml	2004-05-23 20:29:25 UTC (rev 24913)
@@ -0,0 +1,10 @@
+<configure xmlns='http://namespaces.zope.org/zope'>
+
+
+  <adapter
+      for="..interfaces.IFile"
+      provides="zope.app.index.interfaces.text.ISearchableText"
+      factory=".file.SearchableText"
+      />
+
+</configure>

Copied: Zope3/trunk/src/zope/app/file/textindex/file.py (from rev 24906, Zope3/trunk/src/zope/app/file/file.py)
===================================================================
--- Zope3/trunk/src/zope/app/file/file.py	2004-05-23 16:21:33 UTC (rev 24906)
+++ Zope3/trunk/src/zope/app/file/textindex/file.py	2004-05-23 20:29:25 UTC (rev 24913)
@@ -0,0 +1,37 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""File content component
+
+$Id$
+"""
+from zope.app.file.interfaces import IFile
+from zope.app.index.interfaces.text import ISearchableText
+from zope.interface import implements
+
+# XXX need a test here!
+
+class SearchableText(object):
+    """Make File objects searchable."""
+
+    implements(ISearchableText)
+    __used_for__ = IFile
+
+    def __init__(self, file):
+        self.file = file
+
+    def getSearchableText(self):
+        if self.file.contentType == "text/plain":
+            return [unicode(self.file.data)]
+        else:
+            return None

Added: Zope3/trunk/src/zope/app/file/textindex/zope.app.file.textindex-configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/file/textindex/zope.app.file.textindex-configure.zcml	2004-05-23 19:28:22 UTC (rev 24912)
+++ Zope3/trunk/src/zope/app/file/textindex/zope.app.file.textindex-configure.zcml	2004-05-23 20:29:25 UTC (rev 24913)
@@ -0,0 +1 @@
+<include package="zope.app.file.textindex" />


Property changes on: Zope3/trunk/src/zope/app/file/textindex/zope.app.file.textindex-configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native




More information about the Zope3-Checkins mailing list