8
|
1 '''
|
|
2 Created on 02.11.2012
|
|
3
|
|
4 @author: dwinter
|
|
5 '''
|
|
6
|
|
7 import web
|
9
|
8 import managePurls.manageIndexMetaPURLs as manageIndexMetaPURLs
|
8
|
9
|
|
10 class searcher:
|
|
11
|
|
12 def __init__(self):
|
|
13 self.md=manageIndexMetaPURLs.IndexMetaPURLManager()
|
|
14
|
|
15 def GET(self):
|
|
16
|
|
17 input = web.input()
|
|
18
|
|
19 if not hasattr(input, 'q'):
|
|
20 return "usage: ?q=QUERYSTRING"
|
|
21 query = input.q
|
|
22
|
|
23 purls=self.md.search(query)
|
|
24
|
|
25 currentUrl = web.ctx.homepath
|
|
26
|
|
27 if purls is None:
|
|
28 purls=[]
|
|
29
|
|
30 ret="""<div class="results"><div class="purls_found_count">%s</div>"""%len(purls)
|
|
31
|
|
32 for purl in purls:
|
|
33 ret+="""<div class="purls"><a href="%s">%s</a></div>"""%(currentUrl+"/purl/"+purl['purl'],purl['purl'])
|
|
34
|
|
35
|
|
36 web.header('Content-Type', 'text/html')
|
|
37 return ret+"</div>"
|
|
38
|
|
39
|
|
40 if __name__ == '__main__':
|
|
41 pass |