Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

only perform the search once.

  • Loading branch information
glyph committed Aug 12, 2011
1 parent 4c26119 commit f94303b1560739bf1e584ba9c8b1fc691948a0f7
Showing with 6 additions and 1 deletion.
  1. +5 −0 calendarserver/webadmin/resource.py
  2. +1 −1 calendarserver/webadmin/test/test_resource.py
@@ -92,13 +92,18 @@ def hasSearchResults(self, request, tag):
returnValue(tag)


_searchResults = None

@inlineCallbacks
def performSearch(self, request):
if self._searchResults is not None:
returnValue(self._searchResults)
searchTerm = request.args.get('resourceSearch', [''])[0]
if searchTerm:
results = yield self.resource.search(searchTerm)
else:
results = []
self._searchResults = results
returnValue(results)


@@ -54,7 +54,7 @@ def recordsMatchingFields(self, fields):
# 'fields' will be a list of 4-tuples of (fieldName, searchStr, True,
# "contains"; implement this for tests which will want to call
# 'search()')
return self.expectedSearches[tuple(fields)]
return self.expectedSearches.pop(tuple(fields))


def setUp(self):

0 comments on commit f94303b

Please sign in to comment.
You can’t perform that action at this time.