Skip to content

Commit

Permalink
use explicit True/False
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed Apr 7, 2012
1 parent 00bbe19 commit 3fda51c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/Products/ZCatalog/Catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def updateMetadata(self, object, uid, index):
# the cataloging API

def catalogObject(self, object, uid, threshold=None, idxs=None,
update_metadata=1):
update_metadata=True):
"""
Adds an object to the Catalog by iteratively applying it to
all indexes.
Expand Down Expand Up @@ -379,7 +379,6 @@ def uncatalogObject(self, uid):
'attempted to uncatalog an object '
'with a uid of %s. ' % str(uid))


def uniqueValuesFor(self, name):
""" return unique values for FieldIndex name """
return self.getIndex(name).uniqueValues()
Expand Down Expand Up @@ -479,7 +478,8 @@ def _limit_sequence(self, sequence, slen, b_start=0, b_size=None,
sequence.reverse()
return (sequence, slen)

def search(self, query, sort_index=None, reverse=0, limit=None, merge=1):
def search(self,
query, sort_index=None, reverse=False, limit=None, merge=True):
"""Iterate through the indexes, applying the query to each one. If
merge is true then return a lazy result set (sorted if appropriate)
otherwise return the raw (possibly scored) results for later merging.
Expand Down Expand Up @@ -630,7 +630,7 @@ def getScoredResult(item, max=max, self=self):
.__of__(aq_parent(self))
r.data_record_id_ = key
r.data_record_score_ = score
r.data_record_normalized_score_ = int(100. * score / max)
r.data_record_normalized_score_ = int(100.0 * score / max)
return r

sequence, slen = self._limit_sequence(rs, rlen, b_start,
Expand Down Expand Up @@ -663,8 +663,8 @@ def getScoredResult(item, max=max, self=self):
cr.stop()
return result

def sortResults(self, rs, sort_index, reverse=0, limit=None, merge=1,
actual_result_count=None, b_start=0, b_size=None):
def sortResults(self, rs, sort_index, reverse=False, limit=None,
merge=True, actual_result_count=None, b_start=0, b_size=None):
# Sort a result set using a sort index. Return a lazy
# result set in sorted order if merge is true otherwise
# returns a list of (sortkey, uid, getter_function) tuples
Expand Down Expand Up @@ -909,7 +909,7 @@ def _getSortIndex(self, args):
return sort_indexes
return None

def searchResults(self, REQUEST=None, used=None, _merge=1, **kw):
def searchResults(self, REQUEST=None, used=None, _merge=True, **kw):
# You should pass in a simple dictionary as the request argument,
# which only contains the relevant query.
# The used argument is deprecated and is ignored
Expand All @@ -928,12 +928,12 @@ def searchResults(self, REQUEST=None, used=None, _merge=1, **kw):
args = CatalogSearchArgumentsMap(REQUEST, kw)
sort_indexes = self._getSortIndex(args)
sort_limit = self._get_sort_attr('limit', args)
reverse = 0
reverse = False
if sort_indexes is not None:
order = self._get_sort_attr("order", args)
if (isinstance(order, str) and
order.lower() in ('reverse', 'descending')):
reverse = 1
reverse = True
# Perform searches with indexes and sort_index
return self.search(args, sort_indexes, reverse, sort_limit, _merge)

Expand Down

0 comments on commit 3fda51c

Please sign in to comment.