# HG changeset patch # User dwinter # Date 1352188224 -3600 # Node ID a1577a498c8543a449f32cd2ad2a5ed4e20a3e13 # Parent 0287aed01f2b44fb2494d9df981d90004a79b648 metadata redirector added diff -r 0287aed01f2b -r a1577a498c85 restService/restService.py --- a/restService/restService.py Tue Nov 06 08:41:18 2012 +0100 +++ b/restService/restService.py Tue Nov 06 08:50:24 2012 +0100 @@ -13,11 +13,41 @@ '/purl/(.+)','purl', '/docuview/(.+)','redirector', '/search','searcher', + '/indexMeta/(.+)','indexMeta', ) app = web.application(urls, globals()) +TEXTER_URL="http://digilib.mpiwg-berlin.mpg.de/digitallibrary/servlet/Texter?fn=%s" + +class indexMeta: + + def __init__(self): + self.md=manageIndexMetaPURLs.IndexMetaPURLManager() + + + def GET(self,purl): + + path,validity=self.md.getPathValidity(purl) + + if path is None: + raise web.notfound("Cannnot find a URL to this path") + + if validity is manageIndexMetaPURLs.PERM_NON_VALID: + raise web.notfound("PURL NON VALID ANYMORE!") + + if validity is manageIndexMetaPURLs.TEMP_NON_VALID: + return web.notfound("PURL currently not VALID try later!") + + + raise web.redirect(TEXTER_URL%path) + + + def __init__(self): + self.md=manageIndexMetaPURLs.IndexMetaPURLManager() + + class purl: def __init__(self): @@ -39,6 +69,10 @@ return path + + def __init__(self): + self.md=manageIndexMetaPURLs.IndexMetaPURLManager() + if __name__ == "__main__": app.run()