changeset 22:f748e2b684c9

bug in xml output fixed
author dwinter
date Wed, 30 Jan 2013 08:37:48 +0100
parents 90643ccc6545
children 7fdd2d68fd6b
files addDriToIndexMeta.py managePurls/manageIndexMetaPURLs.py restService/config.py restService/getPurls.py restService/templates/serviceDescription.html searchService/searchSolr.py
diffstat 6 files changed, 19 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/addDriToIndexMeta.py	Tue Jan 29 17:20:25 2013 +0100
+++ b/addDriToIndexMeta.py	Wed Jan 30 08:37:48 2013 +0100
@@ -12,6 +12,7 @@
 
 errorFile = file("/tmp/addDRIErrors.txt","w")
 parseErrorFile = file("/tmp/addDRIParseErrors.txt","w")
+alreadyExistsFile = file("/tmp/addDRIalreadyExists.txt","w")
 
 def addPURL(fl,purl,test=False):
     try:
@@ -32,7 +33,9 @@
             metas[0].append(newDri)
     else:
         dris[0].text=purl
-        
+        alreadyExistsFile.write("%s \n"%fl)
+        return True
+
     print etree.tostring(tree, pretty_print=True)
     
     if not test:
@@ -70,4 +73,4 @@
                 dirs.remove(dir)
 
 if __name__ == '__main__':
-     addDriToIndexMeta("/mpiwg/online/",delpath="/mpiwg/online",test=False)
+     addDriToIndexMeta("/mpiwg/online/",delpath="/mpiwg/online",test=True)
--- a/managePurls/manageIndexMetaPURLs.py	Tue Jan 29 17:20:25 2013 +0100
+++ b/managePurls/manageIndexMetaPURLs.py	Wed Jan 30 08:37:48 2013 +0100
@@ -38,8 +38,8 @@
     
   
     def __init__(self):
-        #self.purlDB = web.database(dbn="postgres", db="purlDB",user="purlUSER",password="p*lWa55eR", host="tuxserve03")
-        self.purlDB = web.database(dbn="postgres", db="purlDB",user="purlUSER",password="3333")
+        self.purlDB = web.database(dbn="postgres", db="purlDB",user="purlUSER",password="p*lWa55eR", host="tuxserve03")
+        #self.purlDB = web.database(dbn="postgres", db="purlDB",user="purlUSER",password="3333")
       
  
     
--- a/restService/config.py	Tue Jan 29 17:20:25 2013 +0100
+++ b/restService/config.py	Wed Jan 30 08:37:48 2013 +0100
@@ -1,3 +1,3 @@
-#TEMPLATE_PATH="/usr/local/metadataServices/purlService/restService/templates/"
-TEMPLATE_PATH="/Users/dwinter/Documents/Projekte/MetaDataManagement/purlService/restService/templates/"
-TEXTER_URL="http://digilib.mpiwg-berlin.mpg.de/digitallibrary/servlet/Texter?fn=%s"
\ No newline at end of file
+TEMPLATE_PATH="/usr/local/metadataServices/purlService/restService/templates/"
+#TEMPLATE_PATH="/Users/dwinter/Documents/Projekte/MetaDataManagement/purlService/restService/templates/"
+TEXTER_URL="http://digilib.mpiwg-berlin.mpg.de/digitallibrary/servlet/Texter?fn=%s"
--- a/restService/getPurls.py	Tue Jan 29 17:20:25 2013 +0100
+++ b/restService/getPurls.py	Wed Jan 30 08:37:48 2013 +0100
@@ -18,14 +18,15 @@
         self.purlManager = IndexMetaPURLManager()
         
     def GET(self):
-       
+        
         auth = web.ctx.env.get('HTTP_AUTHORIZATION')
       
         authreq = False
-        if auth is None:
-            authreq = True
+        if auth is None:#no authentification needed, SHOULD BE DONE VIA APACHE!!
+            #authreq = True
+            username = "internal user (Please replace with your username)"
         else:
-            print auth
+
             auth = re.sub('^Basic ','',auth)
             username,password = base64.decodestring(auth).split(':')
             
--- a/restService/templates/serviceDescription.html	Tue Jan 29 17:20:25 2013 +0100
+++ b/restService/templates/serviceDescription.html	Wed Jan 30 08:37:48 2013 +0100
@@ -49,7 +49,7 @@
 
 gives the path to the index.meta at the storage system as XML
 
-eg. purls/searchSolr?text-url-path=/diverse/de/Einst_Bemer_de_1907.xml
+eg. purls/searchSolr?text-url-path=/diverse/de/Einst_Beric_de_1907.xml
 
 an additional parameter <b>format=short</b> suppresses the additional metadata in the output.
 
--- a/searchService/searchSolr.py	Tue Jan 29 17:20:25 2013 +0100
+++ b/searchService/searchSolr.py	Wed Jan 30 08:37:48 2013 +0100
@@ -59,7 +59,7 @@
             if short:
                 key="text-url-path"
                 r=hit.get(key)
-                ret+="""<%s>%s<%s>"""%(key,r,key) 
+                ret+="""<%s>%s</%s>"""%(key,r,key) 
             
             else: 
                 
@@ -71,8 +71,8 @@
                     
                     
                     for r in res:
-    
-                        ret+="""<%s>%s<%s>"""%(key,r,key) 
+                        if not key.startswith("_"):
+                            ret+="""<%s>%s</%s>"""%(key,r,key) 
                 
                 #ret.append(hit.get('archive-path'))