# $Id$ # $URL$ logger = logging.getLogger('meresco.searchform') logger.debug("Starting logger") websiteConfig = infra.configRoot #from sys import stderr def main(arguments={}, path='', *args, **kwargs): language = getLanguage( kwargs['Headers'] ) query = arguments.get('query', [''])[0] logger.debug('query: ' + query) httpQuery = escapeHtml(query) drilldown='' search = websiteConfig.get('searchButton', section="searchform", language=language) goback = websiteConfig.get('gobackButton', section="searchform", language=language) reset = websiteConfig.get('resetButton', section="searchform", language=language) if 'drilldown' in arguments: for value in arguments['drilldown']: drilldown += '&drilldown='+value sortKeys = arguments.get('sortKeys', [''])[0] optionRelevance = "" optionYearDown = "" optionYearUp = "" if not sortKeys or sortKeys == "norm.date.year,,1": optionYearDown = "selected" elif sortKeys == "norm.date.year,," or sortKeys == "norm.date.year,,0": optionYearUp = "selected" elif sortKeys == ",,": optionRelevance = "selected" yield backtick('searchForm.template', { 'drilldown': drilldown, 'httpQuery': httpQuery, 'search': search, 'goback': goback, 'reset': reset, 'optionRelevance': optionRelevance, 'optionYearDown': optionYearDown, 'optionYearUp': optionYearUp })