handlers.py
changeset 96 d30c88e89a7e
parent 87 39915772f090
child 108 d0aca7894fc5
equal deleted inserted replaced
95:ebdbda3dd5d0 96:d30c88e89a7e
     7 from qmsk.web import http, template
     7 from qmsk.web import http, template
     8 
     8 
     9 import urls, channels, helpers
     9 import urls, channels, helpers
    10 import preferences as prefs
    10 import preferences as prefs
    11 from preferences import preferences
    11 from preferences import preferences
    12 import config
    12 import config, log_search
    13 
    13 
    14 # load templates from here
    14 # load templates from here
    15 templates = template.TemplateLoader("templates",
    15 templates = template.TemplateLoader("templates",
    16     _helper_class   = helpers.Helpers,
    16     _helper_class   = helpers.Helpers,
    17     urls            = urls,
    17     urls            = urls,
    18     channel_list    = config.LOG_CHANNELS,
    18     channel_list    = config.LOG_CHANNELS,
    19     config          = config,
    19     config          = config,
    20 )
    20 )
    21 
       
    22 # our LogSearch thing
       
    23 # XXX: move elsewhere
       
    24 import log_search
       
    25 search_index = log_search.LogSearchIndex(config.LOG_CHANNELS, config.SEARCH_INDEX_PATH, 'r')
       
    26 
    21 
    27 def index (request) :
    22 def index (request) :
    28     """
    23     """
    29         The topmost index page, display a list of available channels, perhaps some general stats
    24         The topmost index page, display a list of available channels, perhaps some general stats
    30     """
    25     """
   212 
   207 
   213     # got a search query?
   208     # got a search query?
   214     if q :
   209     if q :
   215         try :
   210         try :
   216             # do search
   211             # do search
   217             lines = search_index.search_simple(channel, q, count, skip)
   212             lines = log_search.get_index().search_simple(channel, q, count, skip)
   218 
   213 
   219             # update max?
   214             # update max?
   220             if max and page > max :
   215             if max and page > max :
   221                 max = page
   216                 max = page
   222         
   217