Mercurial > hg > purlService
comparison restService/restService.py @ 5:3ebe37d81071
addDri added
reorganisation of the packafes
author | dwinter |
---|---|
date | Fri, 02 Nov 2012 09:01:35 +0100 |
parents | restService.py@caeede0c9464 |
children | 733d43b30a82 |
comparison
equal
deleted
inserted
replaced
4:107f13ca333b | 5:3ebe37d81071 |
---|---|
1 ''' | |
2 Created on 31.10.2012 | |
3 | |
4 @author: dwinter | |
5 ''' | |
6 import web | |
7 import manageIndexMetaPURLs | |
8 from redirector import redirector | |
9 import logging | |
10 | |
11 urls = ( | |
12 '/purl/(.+)','purl', | |
13 '/docuviewer/(.+)','redirector', | |
14 ) | |
15 | |
16 app = web.application(urls, globals()) | |
17 | |
18 | |
19 class purl: | |
20 | |
21 def __init__(self): | |
22 self.md=manageIndexMetaPURLs.IndexMetaPURLManager() | |
23 | |
24 def GET(self,purl): | |
25 | |
26 path,validity=self.md.getPathValidity(purl) | |
27 | |
28 if path is None: | |
29 raise web.notfound("Cannnot find a URL to this path") | |
30 | |
31 if validity is manageIndexMetaPURLs.PERM_NON_VALID: | |
32 raise web.notfound("PURL NON VALID ANYMORE!") | |
33 | |
34 if validity is manageIndexMetaPURLs.TEMP_NON_VALID: | |
35 return web.notfound("PURL currently not VALID try later!") | |
36 | |
37 | |
38 return path | |
39 | |
40 | |
41 if __name__ == "__main__": | |
42 app.run() |