Mercurial > hg > purlService
view restService/searcher.py @ 32:ea7017439ab9
parameter f?r getPurls added
author | dwinter |
---|---|
date | Thu, 15 Aug 2013 09:02:04 +0200 |
parents | cf4503528b5e |
children | aced422ae66c |
line wrap: on
line source
''' Created on 02.11.2012 @author: dwinter ''' import web import managePurls.manageIndexMetaPURLs as manageIndexMetaPURLs class searcher: def __init__(self): self.md=manageIndexMetaPURLs.IndexMetaPURLManager() def GET(self): input = web.input() if not hasattr(input, 'q'): return "usage: ?q=QUERYSTRING " if hasattr(input, 'q'): query = input.q purls=self.md.search(query) currentUrl = web.ctx.homepath if purls is None: purls=[] ret="""<div class="results"><div class="purls_found_count">%s</div>"""%len(purls) for purl in purls: ret+="""<div class="purls"><a href="%s">%s</a></div>"""%(currentUrl+"/purl/"+purl['purl'],purl['purl']) web.header('Content-Type', 'text/html') return ret+"</div>" if __name__ == '__main__': pass