2
|
1 '''
|
|
2 Created on 31.10.2012
|
|
3
|
|
4 @author: dwinter
|
|
5 '''
|
|
6 import web
|
9
|
7 import managePurls.manageIndexMetaPURLs as manageIndexMetaPURLs
|
14
|
8 from redirector import redirector
|
3
|
9 import logging
|
8
|
10 from searcher import searcher
|
2
|
11
|
|
12 urls = (
|
3
|
13 '/purl/(.+)','purl',
|
12
|
14 '/docuview/(.+)','redirector',
|
8
|
15 '/search','searcher',
|
13
|
16 '/indexMeta/(.+)','indexMeta',
|
14
|
17 '/','serviceDescription'
|
2
|
18 )
|
|
19
|
|
20 app = web.application(urls, globals())
|
|
21
|
|
22
|
13
|
23 TEXTER_URL="http://digilib.mpiwg-berlin.mpg.de/digitallibrary/servlet/Texter?fn=%s"
|
|
24
|
14
|
25
|
|
26
|
|
27 class serviceDescription:
|
|
28
|
|
29 def __init__(self):
|
|
30 self.render = web.template.render('templates/')
|
|
31 def GET(self):
|
|
32
|
|
33 return self.render.serviceDescription()
|
|
34
|
13
|
35 class indexMeta:
|
|
36
|
|
37 def __init__(self):
|
|
38 self.md=manageIndexMetaPURLs.IndexMetaPURLManager()
|
|
39
|
|
40
|
|
41 def GET(self,purl):
|
|
42
|
|
43 path,validity=self.md.getPathValidity(purl)
|
|
44
|
|
45 if path is None:
|
|
46 raise web.notfound("Cannnot find a URL to this path")
|
|
47
|
|
48 if validity is manageIndexMetaPURLs.PERM_NON_VALID:
|
|
49 raise web.notfound("PURL NON VALID ANYMORE!")
|
|
50
|
|
51 if validity is manageIndexMetaPURLs.TEMP_NON_VALID:
|
|
52 return web.notfound("PURL currently not VALID try later!")
|
|
53
|
|
54
|
|
55 raise web.redirect(TEXTER_URL%path)
|
14
|
56
|
13
|
57
|
|
58
|
2
|
59 class purl:
|
|
60
|
|
61 def __init__(self):
|
|
62 self.md=manageIndexMetaPURLs.IndexMetaPURLManager()
|
|
63
|
|
64 def GET(self,purl):
|
|
65
|
|
66 path,validity=self.md.getPathValidity(purl)
|
|
67
|
|
68 if path is None:
|
|
69 raise web.notfound("Cannnot find a URL to this path")
|
|
70
|
|
71 if validity is manageIndexMetaPURLs.PERM_NON_VALID:
|
|
72 raise web.notfound("PURL NON VALID ANYMORE!")
|
|
73
|
|
74 if validity is manageIndexMetaPURLs.TEMP_NON_VALID:
|
|
75 return web.notfound("PURL currently not VALID try later!")
|
|
76
|
|
77
|
|
78 return path
|
|
79
|
13
|
80
|
14
|
81
|
2
|
82
|
|
83 if __name__ == "__main__":
|
11
|
84 app.run()
|