[Zope-Checkins] CVS: Zope/lib/python/Products/ZCatalog - Catalog.py:1.98 CatalogAwareness.py:1.17 CatalogBrains.py:1.7 CatalogPathAwareness.py:1.10 IZCatalog.py:1.3 Lazy.py:1.7 ZCatalog.py:1.118 ZCatalogIndexes.py:1.8 __init__.py:1.20
Martijn Pieters
mj@zope.com
Wed, 14 Aug 2002 18:25:46 -0400
Update of /cvs-repository/Zope/lib/python/Products/ZCatalog
In directory cvs.zope.org:/tmp/cvs-serv27658/ZCatalog
Modified Files:
Catalog.py CatalogAwareness.py CatalogBrains.py
CatalogPathAwareness.py IZCatalog.py Lazy.py ZCatalog.py
ZCatalogIndexes.py __init__.py
Log Message:
Clean up indentation and trailing whitespace.
=== Zope/lib/python/Products/ZCatalog/Catalog.py 1.97 => 1.98 ===
--- Zope/lib/python/Products/ZCatalog/Catalog.py:1.97 Wed Aug 14 15:50:42 2002
+++ Zope/lib/python/Products/ZCatalog/Catalog.py Wed Aug 14 18:25:15 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 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
-#
+#
##############################################################################
from Persistence import Persistent
@@ -67,12 +67,12 @@
if brains is not None:
self._v_brains = brains
-
+
self.updateBrains()
def clear(self):
""" clear catalog """
-
+
self.data = IOBTree() # mapping of rid to meta_data
self.uids = OIBTree() # mapping of uid to rid
self.paths = IOBTree() # mapping of rid to uid
@@ -118,7 +118,7 @@
def __getitem__(self, index, ttype=type(())):
"""
- Returns instances of self._v_brains, or whatever is passed
+ Returns instances of self._v_brains, or whatever is passed
into self.useBrains.
"""
if type(index) is ttype:
@@ -150,7 +150,7 @@
class mybrains(AbstractCatalogBrain, brains):
pass
-
+
scopy = self.schema.copy()
scopy['data_record_id_']=len(self.schema.keys())
@@ -166,7 +166,7 @@
"""
adds a row to the meta data schema
"""
-
+
schema = self.schema
names = list(self.names)
@@ -176,7 +176,7 @@
if name[0] == '_':
raise 'Invalid Meta-Data Name', \
'Cannot cache fields beginning with "_"'
-
+
if not schema.has_key(name):
if schema.values():
schema[name] = max(schema.values())+1
@@ -197,9 +197,9 @@
# new column? update the brain
self.updateBrains()
-
+
self.__changed__(1) #why?
-
+
def delColumn(self, name):
"""
deletes a row from the meta data schema
@@ -233,7 +233,7 @@
self.data[key] = tuple(rec)
def addIndex(self, name, index_type):
- """Create a new index, given a name and a index_type.
+ """Create a new index, given a name and a index_type.
Old format: index_type was a string, 'FieldIndex' 'TextIndex' or
'KeywordIndex' is no longer valid; the actual index must be instantiated
@@ -248,7 +248,7 @@
if name.startswith('_'):
raise 'Invalid Index Name', 'Cannot index fields beginning with "_"'
-
+
if not name:
raise 'Invalid Index Name', 'Name of index is empty'
@@ -271,15 +271,15 @@
indexes = self.indexes
del indexes[name]
self.indexes = indexes
-
+
def getIndex(self, name):
""" get an index wrapped in the catalog """
return self.indexes[name].__of__(self)
-
+
# the cataloging API
def catalogObject(self, object, uid, threshold=None,idxs=[]):
- """
+ """
Adds an object to the Catalog by iteratively applying it
all indexes.
@@ -288,7 +288,7 @@
'uid' is the unique Catalog identifier for this object
"""
-
+
data = self.data
# meta_data is stored as a tuple for efficiency
@@ -297,17 +297,17 @@
index=self.uids.get(uid, None)
if index is not None:
# old data
-
+
if data.get(index, 0) != newDataRecord:
# Update the meta-data, if necessary
data[index] = newDataRecord
-
+
else:
# new data
-
+
if type(data) is IOBTree:
# New style, get radom id
-
+
index=getattr(self, '_v_nextid', 0)
if index%4000 == 0: index = randid()
while not data.insert(index, newDataRecord):
@@ -332,10 +332,10 @@
try: self.__len__.change(1)
except AttributeError: pass # No managed length (old-style)
-
+
self.uids[uid] = index
self.paths[index] = uid
-
+
total = 0
if idxs==[]: use_indexes = self.indexes.keys()
@@ -353,7 +353,7 @@
return total
def uncatalogObject(self, uid):
- """
+ """
Uncatalog and object from the Catalog. and 'uid' is a unique
Catalog identifier
@@ -384,7 +384,7 @@
LOG('Catalog', ERROR, ('uncatalogObject unsuccessfully '
'attempted to uncatalog an object '
'with a uid of %s. ' % uid))
-
+
def uniqueValuesFor(self, name):
""" return unique values for FieldIndex name """
@@ -422,7 +422,7 @@
for name in self.indexes.keys():
result[name] = self.getIndex(name).getEntryForObject(rid, "")
return result
-
+
## This is the Catalog search engine. Most of the heavy lifting happens below
def _indexedSearch(self, request, sort_index, append, used):
@@ -433,19 +433,19 @@
data = self.data
# Indexes fulfill a fairly large contract here. We hand each
- # index the request mapping we are given (which may be composed
+ # index the request mapping we are given (which may be composed
# of some combination of web request, kw mappings or plain old dicts)
# and the index decides what to do with it. If the index finds work
# for itself in the request, it returns the results and a tuple of
# the attributes that were used. If the index finds nothing for it
# to do then it returns None.
-
+
# For hysterical reasons, if all indexes return None for a given
# request (and no attributes were used) then we append all results
# in the Catalog. This generally happens when the search values
# in request are all empty strings or do not coorespond to any of
# the indexes.
-
+
# Note that if the indexes find query arguments, but the end result
# is an empty sequence, we do nothing
@@ -490,13 +490,13 @@
# it, compute the normalized score, and Lazify it.
rset = rs.byValue(0) # sort it by score
max = float(rset[0][0])
-
+
# Here we define our getter function inline so that
# we can conveniently store the max value as a default arg
# and make the normalized score computation lazy
def getScoredResult(item, max=max, self=self):
"""
- Returns instances of self._v_brains, or whatever is passed
+ Returns instances of self._v_brains, or whatever is passed
into self.useBrains.
"""
score, key = item
@@ -506,14 +506,14 @@
r.data_record_score_ = score
r.data_record_normalized_score_ = int(100. * score / max)
return r
-
+
# Lazify the results
append(LazyMap(getScoredResult, rset))
-
+
elif sort_index is None and not hasattr(rs, 'values'):
# no scores? Just Lazify.
if hasattr(rs, 'keys'):
- rs = rs.keys()
+ rs = rs.keys()
append(LazyMap(self.__getitem__, rs))
else:
# sort. If there are scores, then this block is not
@@ -658,18 +658,18 @@
class CatalogError(Exception): pass
class CatalogSearchArgumentsMap:
- """Multimap catalog arguments coming simultaneously from keywords
+ """Multimap catalog arguments coming simultaneously from keywords
and request.
-
+
Values that are empty strings are treated as non-existent. This is
- to ignore empty values, thereby ignoring empty form fields to be
+ to ignore empty values, thereby ignoring empty form fields to be
consistent with hysterical behavior.
"""
-
+
def __init__(self, request, keywords):
self.request = request or {}
self.keywords = keywords or {}
-
+
def __getitem__(self, key):
marker = []
v = self.keywords.get(key, marker)
@@ -678,7 +678,7 @@
if v == '':
raise KeyError(key)
return v
-
+
def get(self, key, default=None):
try:
v = self[key]
@@ -686,7 +686,7 @@
return default
else:
return v
-
+
def has_key(self, key):
try:
self[key]
@@ -694,8 +694,8 @@
return 0
else:
return 1
-
-
+
+
def mergeResults(r, has_sort_keys, reverse):
"""Sort/merge sub-results, generating a flat sequence.
@@ -728,4 +728,3 @@
tmp.append(elt)
size += len(elt)
return LazyCat(tmp, size)
-
=== Zope/lib/python/Products/ZCatalog/CatalogAwareness.py 1.16 => 1.17 ===
--- Zope/lib/python/Products/ZCatalog/CatalogAwareness.py:1.16 Fri Jul 5 08:38:08 2002
+++ Zope/lib/python/Products/ZCatalog/CatalogAwareness.py Wed Aug 14 18:25:15 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 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
-#
+#
##############################################################################
"""ZCatalog Findable class
@@ -28,7 +28,7 @@
it is added or copied in Zope. If you make changes to your own
object, you are responsible for calling your object's index_object
method. """
-
+
meta_type='CatalogAware'
default_catalog='Catalog'
@@ -40,7 +40,7 @@
message = "Your changes have been saved"
if REQUEST is not None:
return self.manage_main(self, REQUEST, manage_tabs_message=message)
-
+
def manage_afterAdd(self, item, container):
self.index_object()
@@ -135,12 +135,3 @@
for item in obj.objectValues():
self.reindex_all(self, item)
return 'done!'
-
-
-
-
-
-
-
-
-
=== Zope/lib/python/Products/ZCatalog/CatalogBrains.py 1.6 => 1.7 ===
--- Zope/lib/python/Products/ZCatalog/CatalogBrains.py:1.6 Sun Jun 30 02:37:53 2002
+++ Zope/lib/python/Products/ZCatalog/CatalogBrains.py Wed Aug 14 18:25:15 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 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
-#
+#
##############################################################################
__version__ = "$Revision$"[11:-2]
@@ -28,7 +28,7 @@
def getPath(self):
"""Get the physical path for this record"""
return self.aq_parent.getpath(self.data_record_id_)
-
+
def getURL(self):
"""Try to generate a URL for this record"""
try:
@@ -49,11 +49,11 @@
zLOG.LOG('CatalogBrains', zLOG.INFO, 'getObject raised an error',
error=sys.exc_info())
pass
-
+
def getRID(self):
"""Return the record ID for this object."""
return self.data_record_id_
-
+
class NoBrainer:
""" This is an empty class to use when no brain is specified. """
pass
=== Zope/lib/python/Products/ZCatalog/CatalogPathAwareness.py 1.9 => 1.10 ===
--- Zope/lib/python/Products/ZCatalog/CatalogPathAwareness.py:1.9 Fri Jul 5 08:38:08 2002
+++ Zope/lib/python/Products/ZCatalog/CatalogPathAwareness.py Wed Aug 14 18:25:15 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 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
-#
+#
##############################################################################
"""ZCatalog Findable class"""
@@ -25,7 +25,7 @@
it is added or copied in Zope. If you make changes to your own
object, you are responsible for calling your object's index_object
method. """
-
+
meta_type='CatalogAware'
default_catalog='Catalog'
@@ -37,7 +37,7 @@
message = "Your changes have been saved"
if REQUEST is not None:
return self.manage_main(self, REQUEST, manage_tabs_message=message)
-
+
def manage_afterAdd(self, item, container):
self.index_object()
@@ -81,7 +81,7 @@
def getPath(self):
"""Return the physical path for an object."""
return '/'.join(self.getPhysicalPath())
-
+
def summary(self, num=200):
"""Return a summary of the text content of the object."""
if not hasattr(self, 'text_content'):
@@ -133,11 +133,3 @@
nontrivial, we don't want to spend a lot of time on ZClasses, and
this works.
"""
-
-
-
-
-
-
-
-
=== Zope/lib/python/Products/ZCatalog/IZCatalog.py 1.2 => 1.3 ===
--- Zope/lib/python/Products/ZCatalog/IZCatalog.py:1.2 Wed Aug 14 15:10:14 2002
+++ Zope/lib/python/Products/ZCatalog/IZCatalog.py Wed Aug 14 18:25:15 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 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.
-#
+#
##############################################################################
"""
$Id$
@@ -35,20 +35,20 @@
Keyword -- Keyword indexes index sequences of values. The index
can be used to search for objects that match one or more of the
search terms.
-
+
Path -- Path indexes index URI paths. They allow you to find objects
based on their placement in a hierarchy.
-
+
Date -- Date indexes index date and type data. They are a type of field
index specifically optimized for indexing dates.
Date Range -- Date range indexes index time intervals. They are designed
for efficient searching of dates falling between two boundaries
(such as effective / expiration dates).
-
+
Topic -- Topic indexes store prefiltered sets of documents. They are used
- to optimize complex queries into a single fast query by prefiltering
- documents by an expression
+ to optimize complex queries into a single fast query by prefiltering
+ documents by an expression
The ZCatalog can maintain a table of extra data about cataloged
objects. This information can be used on search result pages to
@@ -61,7 +61,7 @@
ZCatalog does not store references to the objects themselves, but
rather to a unique identifier that defines how to get to the
object. In Zope, this unique identifier is the object's relative
- path to the ZCatalog (since two Zope objects cannot have the same
+ path to the ZCatalog (since two Zope objects cannot have the same
URL, this is an excellent unique qualifier in Zope).
"""
@@ -108,11 +108,11 @@
def index_objects():
"""Returns a sequence of actual index objects.
-
+
NOTE: This returns unwrapped indexes! You should probably use
getIndexObjects instead. Some indexes expect to be wrapped.
"""
-
+
def getIndexObjects():
"""Returns a list of acquisition wrapped index objects
"""
@@ -184,7 +184,7 @@
documented in The Zope Book.
"""
-
+
def __call__(REQUEST=None, **kw):
"""Search the catalog, the same way as 'searchResults'.
"""
=== Zope/lib/python/Products/ZCatalog/Lazy.py 1.6 => 1.7 ===
--- Zope/lib/python/Products/ZCatalog/Lazy.py:1.6 Wed Nov 28 10:51:09 2001
+++ Zope/lib/python/Products/ZCatalog/Lazy.py Wed Aug 14 18:25:15 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 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
-#
+#
##############################################################################
__doc__='''$Id$'''
__version__='$Revision$'[11:-2]
@@ -20,7 +20,7 @@
__allow_access_to_unprotected_subobjects__=1
def __repr__(self): return `list(self)`
-
+
def __len__(self):
try: return self._len
@@ -62,7 +62,7 @@
seq.append(other)
return LazyCat(seq)
-
+
def __getslice__(self,i1,i2):
r=[]
for i in xrange(i1,i2):
@@ -75,7 +75,7 @@
class LazyCat(Lazy):
# Lazy concatenation of one or more sequences. Should be handy
# for accessing small parts of big searches.
-
+
def __init__(self, sequences, length=None):
self._seq=sequences
self._data=[]
=== Zope/lib/python/Products/ZCatalog/ZCatalog.py 1.117 => 1.118 ===
--- Zope/lib/python/Products/ZCatalog/ZCatalog.py:1.117 Wed Aug 14 15:40:40 2002
+++ Zope/lib/python/Products/ZCatalog/ZCatalog.py Wed Aug 14 18:25:15 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 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
-#
+#
##############################################################################
"""ZCatalog product"""
@@ -46,7 +46,7 @@
"""Add a ZCatalog object
"""
id=str(id)
- title=str(title)
+ title=str(title)
c=ZCatalog(id, title, vocab_id, self)
self._setObject(id, c)
if REQUEST is not None:
@@ -59,13 +59,13 @@
"""ZCatalog object
A ZCatalog contains arbirary index like references to Zope
- objects. ZCatalog's can index either 'Field' values of object, or
+ objects. ZCatalog's can index either 'Field' values of object, or
'Text' values.
ZCatalog does not store references to the objects themselves, but
rather to a unique identifier that defines how to get to the
object. In Zope, this unique idenfier is the object's relative
- path to the ZCatalog (since two Zope object's cannot have the same
+ path to the ZCatalog (since two Zope object's cannot have the same
URL, this is an excellent unique qualifier in Zope).
Most of the dirty work is done in the _catalog object, which is an
@@ -92,13 +92,13 @@
'action': 'manage_catalogIndexes',
'help': ('ZCatalog','ZCatalog_Indexes.stx')},
{'label': 'Metadata', # TAB: Metadata
- 'action': 'manage_catalogSchema',
+ 'action': 'manage_catalogSchema',
'help':('ZCatalog','ZCatalog_MetaData-Table.stx')},
{'label': 'Find Objects', # TAB: Find Objects
- 'action': 'manage_catalogFind',
+ 'action': 'manage_catalogFind',
'help':('ZCatalog','ZCatalog_Find-Items-to-ZCatalog.stx')},
{'label': 'Advanced', # TAB: Advanced
- 'action': 'manage_catalogAdvanced',
+ 'action': 'manage_catalogAdvanced',
'help':('ZCatalog','ZCatalog_Advanced.stx')},
{'label': 'Undo', # TAB: Undo
'action': 'manage_UndoForm',
@@ -116,19 +116,19 @@
('Manage ZCatalog Entries',
['manage_catalogObject', 'manage_uncatalogObject',
'catalog_object', 'uncatalog_object', 'refreshCatalog',
-
+
'manage_catalogView', 'manage_catalogFind',
'manage_catalogSchema', 'manage_catalogIndexes',
'manage_catalogAdvanced', 'manage_objectInformation',
-
+
'manage_catalogReindex', 'manage_catalogFoundItems',
'manage_catalogClear', 'manage_addColumn', 'manage_delColumn',
'manage_addIndex', 'manage_delIndex', 'manage_clearIndex',
'manage_reindexIndex', 'manage_main', 'availableSplitters',
-
+
# these two are deprecated:
'manage_delColumns', 'manage_deleteIndex'
- ],
+ ],
['Manager']),
('Search ZCatalog',
@@ -136,7 +136,7 @@
'getpath', 'schema', 'indexes', 'index_objects', 'getIndexObjects'
'all_meta_types', 'valid_roles', 'resolve_url',
'getobject'],
- ['Anonymous', 'Manager']),
+ ['Anonymous', 'Manager']),
)
@@ -154,21 +154,21 @@
threshold=10000
_v_total=0
_v_transaction = None
-
+
def __init__(self, id, title='', vocab_id=None, container=None):
# ZCatalog no longer cares about vocabularies
# so the vocab_id argument is ignored (Casey)
-
+
if container is not None:
self=self.__of__(container)
self.id=id
self.title=title
-
- # vocabulary and vocab_id are left for backwards
+
+ # vocabulary and vocab_id are left for backwards
# compatibility only, they are not used anymore
self.vocabulary = None
- self.vocab_id = ''
-
+ self.vocab_id = ''
+
self.threshold = 10000
self._v_total = 0
@@ -176,8 +176,8 @@
def __len__(self):
return len(self._catalog)
-
-
+
+
# getVocabulary method is no longer supported
# def getVocabulary(self):
# """ more ack! """
@@ -200,7 +200,7 @@
self.threshold = None
else:
self.threshold = 10000
-
+
RESPONSE.redirect(
URL1 +
'/manage_catalogAdvanced?manage_tabs_message=Catalog%20Changed')
@@ -210,12 +210,12 @@
if urls:
if isinstance(urls, types.StringType):
urls=(urls,)
-
+
for url in urls:
obj = self.resolve_path(url)
if not obj:
obj = self.resolve_url(url, REQUEST)
- if obj is not None:
+ if obj is not None:
self.catalog_object(obj, url)
RESPONSE.redirect(
@@ -248,14 +248,14 @@
elapse = time.time() - elapse
c_elapse = time.clock() - c_elapse
-
+
RESPONSE.redirect(
URL1 +
'/manage_catalogAdvanced?manage_tabs_message=' +
urllib.quote('Catalog Updated \n'
'Total time: %s\n'
'Total CPU time: %s' % (`elapse`, `c_elapse`)))
-
+
def refreshCatalog(self, clear=0):
""" re-index everything we can find """
@@ -289,18 +289,18 @@
obj_expr=None, obj_mtime=None,
obj_mspec=None, obj_roles=None,
obj_permission=None):
-
+
""" Find object according to search criteria and Catalog them
"""
elapse = time.time()
c_elapse = time.clock()
-
+
words = 0
obj = REQUEST.PARENTS[1]
path = '/'.join(obj.getPhysicalPath())
-
+
results = self.ZopeFindAndApply(obj,
obj_metatypes=obj_metatypes,
obj_ids=obj_ids,
@@ -317,16 +317,16 @@
elapse = time.time() - elapse
c_elapse = time.clock() - c_elapse
-
+
RESPONSE.redirect(
URL1 +
'/manage_catalogView?manage_tabs_message=' +
urllib.quote('Catalog Updated\n'
'Total time: %s\n'
- 'Total CPU time: %s'
+ 'Total CPU time: %s'
% (`elapse`, `c_elapse`))
)
-
+
def manage_addColumn(self, name, REQUEST=None, RESPONSE=None, URL1=None):
""" add a column """
@@ -351,7 +351,7 @@
"\n"
"Please use instead the manage_delColumn method.\n"
,DeprecationWarning)
-
+
self.manage_delColumn(names, REQUEST=REQUEST, RESPONSE=RESPONSE,
URL1=URL1)
@@ -360,7 +360,7 @@
""" delete a column or some columns """
if isinstance(names, types.StringType):
names = (names,)
-
+
for name in names:
self.delColumn(name)
@@ -379,7 +379,7 @@
RESPONSE.redirect(
URL1 +
'/manage_catalogIndexes?manage_tabs_message=Index%20Added')
-
+
def manage_deleteIndex(self, ids=None, REQUEST=None, RESPONSE=None,
URL1=None):
@@ -395,7 +395,7 @@
"\n"
"Please use instead the manage_delIndex method.\n"
,DeprecationWarning)
-
+
self.manage_delIndex(ids=ids, REQUEST=REQUEST, RESPONSE=RESPONSE,
URL1=URL1)
@@ -413,7 +413,7 @@
for name in ids:
self.delIndex(name)
-
+
if REQUEST and RESPONSE:
RESPONSE.redirect(
URL1 +
@@ -433,7 +433,7 @@
for name in ids:
self.clearIndex(name)
-
+
if REQUEST and RESPONSE:
RESPONSE.redirect(
URL1 +
@@ -441,7 +441,7 @@
def reindexIndex(self,name,REQUEST):
-
+
paths = tuple(self._catalog.paths.values())
for p in paths:
@@ -449,7 +449,7 @@
if not obj:
obj = self.resolve_url(p, REQUEST)
if obj is not None:
- self.catalog_object(obj, p, idxs=[name])
+ self.catalog_object(obj, p, idxs=[name])
def manage_reindexIndex(self, ids=None, REQUEST=None, RESPONSE=None,
@@ -459,7 +459,7 @@
return MessageDialog(title='No items specified',
message='No items were specified!',
action = "./manage_catalogIndexes",)
-
+
if isinstance(ids, types.StringType):
ids = (ids,)
@@ -498,7 +498,7 @@
# indexing code. We throw away the result of the call to
# catalogObject (which is a word count), because it's
# worthless to us here.
-
+
if self.threshold is not None:
# figure out whether or not to commit a subtransaction.
t = id(get_transaction())
@@ -555,7 +555,7 @@
def getIndexDataForRID(self, rid):
"""return the current index contents for the specific rid"""
return self._catalog.getIndexDataForRID(rid)
-
+
def schema(self):
return self._catalog.schema.keys()
@@ -566,7 +566,7 @@
# This method returns unwrapped indexes!
# You should probably use getIndexObjects instead
return self._catalog.indexes.values()
-
+
def getIndexObjects(self):
# Return a list of wrapped(!) indexes
catalog = self._catalog
@@ -596,9 +596,9 @@
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.
+ arguments.
"""
return self._catalog.searchResults(REQUEST, used, **kw)
@@ -608,7 +608,7 @@
## this stuff is so the find machinery works
meta_types=() # Sub-object types that are specific to this object
-
+
# Dont need this anymore -- we inherit from object manager
#def all_meta_types(self):
# pmt=()
@@ -649,7 +649,7 @@
This is a *great* hack. Zope find just doesn't do what we
need here; the ability to apply a method to all the objects
- *as they're found* and the need to pass the object's path into
+ *as they're found* and the need to pass the object's path into
that method.
"""
@@ -659,7 +659,7 @@
if obj_metatypes and 'all' in obj_metatypes:
obj_metatypes=None
-
+
if obj_mtime and type(obj_mtime)==type('s'):
obj_mtime=DateTime(obj_mtime).timeTime()
@@ -668,7 +668,7 @@
if obj_roles and type(obj_roles) is type('s'):
obj_roles=[obj_roles]
-
+
if obj_expr:
# Setup expr machinations
md=td()
@@ -690,7 +690,7 @@
for id, ob in items:
if pre: p="%s/%s" % (pre, id)
else: p=id
-
+
dflag=0
if hasattr(ob, '_p_changed') and (ob._p_changed == None):
dflag=1
@@ -723,7 +723,7 @@
else:
add_result((p, ob))
dflag=0
-
+
if search_sub and hasattr(bs, 'objectItems'):
self.ZopeFindAndApply(ob, obj_ids, obj_metatypes,
obj_searchterm, obj_expr,
@@ -737,7 +737,7 @@
return result
def resolve_url(self, path, REQUEST):
- """
+ """
Attempt to resolve a url into an object in the Zope
namespace. The url may be absolute or a catalog path
style url. If no object is found, None is returned.
@@ -745,12 +745,12 @@
"""
script=REQUEST.script
if path.find(script) != 0:
- path='%s/%s' % (script, path)
+ path='%s/%s' % (script, path)
try: return REQUEST.resolve_url(path)
except: pass
def resolve_path(self, path):
- """
+ """
Attempt to resolve a url into an object in the Zope
namespace. The url may be absolute or a catalog path
style url. If no object is found, None is returned.
@@ -813,7 +813,7 @@
def manage_convertIndex(self, ids, REQUEST=None, RESPONSE=None, URL1=None):
"""convert old-style indexes to new-style indexes"""
- from Products.PluginIndexes.KeywordIndex import KeywordIndex
+ from Products.PluginIndexes.KeywordIndex import KeywordIndex
from Products.PluginIndexes.FieldIndex import FieldIndex
from Products.PluginIndexes.TextIndex import TextIndex
@@ -845,10 +845,10 @@
'/manage_main?'
'manage_tabs_message='
'No%20indexes%20found%20to%20be%20converted')
-
+
#
- # Indexing methods
+ # Indexing methods
#
def addIndex(self, name, type,extra=None):
@@ -861,7 +861,7 @@
p = None
for prod in products:
- if prod['name'] == type:
+ if prod['name'] == type:
p = prod
break
@@ -882,7 +882,7 @@
index = apply(base,(name,), {"extra":extra,"caller":self})
else:
index = base(name,self)
-
+
self._catalog.addIndex(name,index)
@@ -899,7 +899,7 @@
def delColumn(self, name):
return self._catalog.delColumn(name)
-
+
Globals.default__class_init__(ZCatalog)
@@ -924,13 +924,13 @@
def mtime_match(ob, t, q, fn=hasattr):
if not fn(ob, '_p_mtime'):
- return 0
+ return 0
return q=='<' and (ob._p_mtime < t) or (ob._p_mtime > t)
def role_match(ob, permission, roles, lt=type([]), tt=type(())):
pr=[]
fn=pr.append
-
+
while 1:
if hasattr(ob, permission):
p=getattr(ob, permission)
=== Zope/lib/python/Products/ZCatalog/ZCatalogIndexes.py 1.7 => 1.8 ===
--- Zope/lib/python/Products/ZCatalog/ZCatalogIndexes.py:1.7 Fri Jun 28 13:25:23 2002
+++ Zope/lib/python/Products/ZCatalog/ZCatalogIndexes.py Wed Aug 14 18:25:15 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 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
-#
+#
##############################################################################
"""$Id$
@@ -42,19 +42,19 @@
meta_type = "ZCatalogIndex"
manage_options = ()
-
+
security = ClassSecurityInfo()
-
+
security.declareObjectProtected(manage_zcatalog_indexes)
security.setPermissionDefault(manage_zcatalog_indexes, ('Manager',))
security.declareProtected(manage_zcatalog_indexes, 'addIndexForm')
addIndexForm= DTMLFile('dtml/addIndexForm',globals())
-
+
# You no longer manage the Indexes here, they are managed from ZCatalog
def manage_main(self, REQUEST, RESPONSE):
"""Redirect to the parent where the management screen now lives"""
RESPONSE.redirect('../manage_catalogIndexes')
-
+
manage_workspace = manage_main
#
@@ -62,7 +62,7 @@
#
# base accessors loop back through our dictionary interface
- def _setOb(self, id, object):
+ def _setOb(self, id, object):
indexes = self.aq_parent._catalog.indexes
indexes[id] = object
self.aq_parent._indexes = indexes
@@ -74,14 +74,14 @@
self.aq_parent._indexes = indexes
#self.aq_parent._p_changed = 1
- def _getOb(self, id, default=_marker):
+ def _getOb(self, id, default=_marker):
indexes = self.aq_parent._catalog.indexes
if default is _marker: return indexes.get(id)
return indexes.get(id, default)
-
+
security.declareProtected(manage_zcatalog_indexes, 'objectIds')
def objectIds(self, spec=None):
-
+
indexes = self.aq_parent._catalog.indexes
if spec is not None:
if type(spec) == type('s'):
@@ -121,15 +121,13 @@
class OldCatalogWrapperObject(SimpleItem, Implicit):
manage_options= (
- {'label': 'Settings',
+ {'label': 'Settings',
'action': 'manage_main'},
)
-
+
manage_main = DTMLFile('dtml/manageOldindex',globals())
manage_main._setName('manage_main')
manage_workspace = manage_main
def __init__(self, o):
self.index = o
-
-
=== Zope/lib/python/Products/ZCatalog/__init__.py 1.19 => 1.20 ===
--- Zope/lib/python/Products/ZCatalog/__init__.py:1.19 Fri Apr 12 15:26:49 2002
+++ Zope/lib/python/Products/ZCatalog/__init__.py Wed Aug 14 18:25:15 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 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
-#
+#
##############################################################################
"""ZCatalog product"""
@@ -26,7 +26,7 @@
def initialize(context):
context.registerClass(
- ZCatalog.ZCatalog,
+ ZCatalog.ZCatalog,
permission='Add ZCatalogs',
constructors=(ZCatalog.manage_addZCatalogForm,
ZCatalog.manage_addZCatalog),
@@ -40,7 +40,6 @@
Vocabulary.manage_addVocabulary),
icon='www/Vocabulary.gif',
)
-
+
context.registerHelp()
context.registerHelpTitle('Zope Help')
-