~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/controllers/search_ui.py

  • Committer: Jelmer Vernooij
  • Date: 2008-08-06 18:33:20 UTC
  • mto: (197.1.9 pathargs)
  • mto: This revision was merged to the branch mainline in revision 202.
  • Revision ID: jelmer@samba.org-20080806183320-6llann0k480dlb9y
add --log-folder option.

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
19
22
from loggerhead.controllers import TemplatedBranchView
20
23
from loggerhead import search
21
24
 
22
25
 
23
26
class SearchUI(TemplatedBranchView):
24
27
    """
25
 
 
 
28
    
26
29
    Class to output progressive search result terms.
27
30
    """
28
31
 
29
32
    template_path = 'loggerhead.templates.search'
30
33
 
31
 
    def get_values(self, path, kwargs, response):
 
34
    def get_values(self, h, args, kwargs, response):
32
35
        """
33
36
        Default method called from the search box as /search URL
34
37
 
38
41
        terms = []
39
42
        query = kwargs['query']
40
43
        if len(query) > 0:
41
 
            terms = search.search_revisions(self._branch.branch, query, True)
 
44
            terms = search.search_revisions(h._branch, query, True)
42
45
            if terms is not None:
43
46
                terms = [term[0] for term in terms]
44
47
            else:
45
48
                # Should show a 'search is not available' etc box.
46
49
                terms = []
47
50
 
48
 
        return {'terms': terms}
 
51
        return {'terms':terms}