changeset 33:aced422ae66c

added post resquest for search
author dwinter
date Wed, 28 Aug 2013 12:57:36 +0200
parents ea7017439ab9
children d3ecbfd21e06
files restService/searcher.py restService/templates/serviceDescription.html
diffstat 2 files changed, 30 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/restService/searcher.py	Thu Aug 15 09:02:04 2013 +0200
+++ b/restService/searcher.py	Wed Aug 28 12:57:36 2013 +0200
@@ -29,8 +29,12 @@
             currentUrl = web.ctx.homepath
             
             if purls is None:
-                purls=[]
+                #versuche noch mal mit "/index.meta"
+                purls=self.md.search(query+"/index.meta")
+                if purls is None:
+                    purls=[]    
             
+
             ret="""<div class="results"><div class="purls_found_count">%s</div>"""%len(purls)
             
             for purl in purls:
@@ -41,6 +45,25 @@
             return ret+"</div>"
             
             
+    def POST(self):
+        data = web.data()
+        ret=[]
+        print data
+        for line in data.split("\n"):
+            purls=self.md.search(line)
+            
+            if purls is None:
+                #versuche noch mal mit "/index.meta"
+                purls=self.md.search(line+"/index.meta")
+                if purls is None:
+                    purls=[]    
+            
+
+            for purl in purls:
+                ret.append("%s\t%s"%(line,purl['purl']))
+            
+            
+        return "\n".join(ret)
          
 if __name__ == '__main__':
     pass
\ No newline at end of file
--- a/restService/templates/serviceDescription.html	Thu Aug 15 09:02:04 2013 +0200
+++ b/restService/templates/serviceDescription.html	Wed Aug 28 12:57:36 2013 +0200
@@ -6,13 +6,17 @@
 <h2>/imagePath/PURL</h2>
 <p> Takes a <em>PURL</em>  and returns the image Path as TXT, if stored, otherwise an empty string is returned.
 
-h2>/imageURL/PURL</h2>
+<h2>/imageURL/PURL</h2>
 <p> Takes a <em>PURL</em>  and returns the image URL at the scaler all parameters are passed through, if stored, otherwise an empty string is returned.
 
 <h2>/search</h2>
+<p>Searched the PURL or all PURLs, wich belong to the PATH the internal search format is "LIKE" </p>
+
+<h3>GET</h3>
 <p>needs a parameter ?q=PATH </p>
 
-<p>Searched the PURL or all PURLs, wich belong to the PATH the internal search format is "LIKE" </p>
+<h3>POST</h3>
+<p>expects at \n separated list of paths and returns a list with the path and the purl.
 
 <h2>/docuview/PURL</h3>