Skip to content

Commit

Permalink
Yeah...Zope is now a regex|ts_regex|regsub zone. Replaced and removed…
Browse files Browse the repository at this point in the history
… all old regex stuff. No one survived.
  • Loading branch information
zopyx committed Apr 27, 2001
1 parent c04f8e5 commit 9c838cd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 36 deletions.
24 changes: 2 additions & 22 deletions Catalog.py
Expand Up @@ -86,9 +86,8 @@
from Persistence import Persistent
import Acquisition
import ExtensionClass
from SearchIndex import UnIndex, UnTextIndex, UnKeywordIndex, Query
from SearchIndex import UnIndex, UnTextIndex, UnKeywordIndex
from SearchIndex.Lexicon import Lexicon
import regex, pdb
from MultiMapping import MultiMapping
from string import lower
import Record
Expand All @@ -106,19 +105,6 @@

import time

def orify(seq,
query_map={
type(regex.compile('')): Query.Regex,
type(''): Query.String,
}):
subqueries=[]
for q in seq:
try: q=query_map[type(q)](q)
except KeyError: q=Query.Cmp(q)
subqueries.append(q)
return apply(Query.Or,tuple(subqueries))


class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
""" An Object Catalog
Expand Down Expand Up @@ -607,13 +593,7 @@ def _indexedSearch(self, args, sort_index, append, used):

return used

def searchResults(self, REQUEST=None, used=None,
query_map={
type(regex.compile('')): Query.Regex,
type([]): orify,
type(''): Query.String,
}, **kw):

def searchResults(self, REQUEST=None, used=None, **kw):
# Get search arguments:
if REQUEST is None and not kw:
try: REQUEST=self.REQUEST
Expand Down
17 changes: 4 additions & 13 deletions ZCatalog.py
Expand Up @@ -90,17 +90,15 @@
from OFS.FindSupport import FindSupport
from DateTime import DateTime
from SearchIndex import Query
import string, regex, urlparse, urllib, os, sys, time
import string, urlparse, urllib, os, sys, time
import Products
from Acquisition import Implicit
from Persistence import Persistent
from DocumentTemplate.DT_Util import InstanceDict, TemplateDict
from DocumentTemplate.DT_Util import Eval, expr_globals
from AccessControl.Permission import name_trans
from Catalog import Catalog, orify, CatalogError
from SearchIndex import UnIndex, UnTextIndex
from Catalog import Catalog, CatalogError
from Vocabulary import Vocabulary
from Shared.DC.ZRDB.TM import TM
from AccessControl import getSecurityManager
from zLOG import LOG, ERROR

Expand Down Expand Up @@ -518,21 +516,14 @@ def _searchable_result_columns(self):
'width': 8})
return r

def searchResults(self, REQUEST=None, used=None,
query_map={
type(regex.compile('')): Query.Regex,
type([]): orify,
type(()): orify,
type(''): Query.String,
}, **kw):
def searchResults(self, REQUEST=None, used=None, **kw):
"""
Search the catalog according to the ZTables search interface.
Search terms can be passed in the REQUEST or as keyword
arguments.
"""

return apply(self._catalog.searchResults,
(REQUEST,used, query_map), kw)
return apply(self._catalog.searchResults, (REQUEST,used), kw)

__call__=searchResults

Expand Down
2 changes: 1 addition & 1 deletion dtml/catalogView.dtml
Expand Up @@ -46,7 +46,7 @@
</td>
<td align="left" valign="top">
<div class="form-text">
<dtml-with name="aq_self" only>
<dtml-with sequence-item only>
<dtml-if name="meta_type">
<dtml-var name="meta_type" size="15">
<dtml-else>
Expand Down

0 comments on commit 9c838cd

Please sign in to comment.