changeset 13:a1577a498c85

metadata redirector added
author dwinter
date Tue, 06 Nov 2012 08:50:24 +0100
parents 0287aed01f2b
children a2bcca6539fd
files restService/restService.py
diffstat 1 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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()