~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/controllers/search_ui.py

  • Committer: Martin Pool
  • Date: 2011-11-23 08:33:12 UTC
  • mto: This revision was merged to the branch mainline in revision 461.
  • Revision ID: mbp@canonical.com-20111123083312-4stzhfv5843jxv2k
Bump version to 1.18.1; compatible with bzr 2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
17
#
18
18
 
19
 
from paste.httpexceptions import HTTPServerError
20
 
from loggerhead import history
21
 
from loggerhead import util
22
19
from loggerhead.controllers import TemplatedBranchView
23
20
from loggerhead import search
24
21
 
25
22
 
26
23
class SearchUI(TemplatedBranchView):
27
24
    """
28
 
    
 
25
 
29
26
    Class to output progressive search result terms.
30
27
    """
31
28
 
32
29
    template_path = 'loggerhead.templates.search'
33
30
 
34
 
    def get_values(self, h, args, kwargs, response):
 
31
    def get_values(self, path, kwargs, response):
35
32
        """
36
33
        Default method called from the search box as /search URL
37
34
 
41
38
        terms = []
42
39
        query = kwargs['query']
43
40
        if len(query) > 0:
44
 
            terms = search.search_revisions(h._branch, query, True)
 
41
            terms = search.search_revisions(self._branch.branch, query, True)
45
42
            if terms is not None:
46
43
                terms = [term[0] for term in terms]
47
44
            else:
48
45
                # Should show a 'search is not available' etc box.
49
46
                terms = []
50
47
 
51
 
        return {'terms':terms}
 
48
        return {'terms': terms}