# HG changeset patch # User dwinter # Date 1382524102 -7200 # Node ID d3ecbfd21e06bca058388f27880a3f58e313cb5d # Parent aced422ae66cb9eb5ff3df97685f725ce772a17d# Parent a25bfc49a068371c555ac034df1a24e349850163 Merge with a25bfc49a068371c555ac034df1a24e349850163 diff -r aced422ae66c -r d3ecbfd21e06 restService/getPurls.py --- a/restService/getPurls.py Wed Aug 28 12:57:36 2013 +0200 +++ b/restService/getPurls.py Wed Oct 23 12:28:22 2013 +0200 @@ -61,25 +61,41 @@ username=inp.get("userName",None) amount=inp.get("amount",None) + outFormat=inp.get("format","html") + if (username==None) or (amount==None): - raise web.badrequest("Username and amount have to be send!") + raise web.badrequest("UserName and amount have to be send!") try: amount=int(amount) except: raise web.badrequest("Amount is not an integer!") - if amount>10: + if amount>1000: raise web.badrequest("Amount is to large (maximum 10)") purls=[] for i in range(amount): purls.append(self.purlManager.register(user=username)) - - return self.render.registeredPurlsResponse(purls) - + if outFormat == "html": + return self.render.registeredPurlsResponse(purls) + elif outFormat == "plain": + ret="" + for p in purls: + ret+="%s\n"%p[1] + web.header('Content-Type', 'text/plain') + return ret + elif outFormat == "plain-noPrefix": + ret="" + for p in purls: + ret+="%s\n"%p[1].replace("MPIWG:","") + + web.header('Content-Type', 'text/plain') + return ret + else: + raise web.badrequest("Allowed parameters for format are only html, plain and plain-noPrefix. The default is html was %s.."%outFormat) class randomSearch: def __init__(self): diff -r aced422ae66c -r d3ecbfd21e06 restService/images.py --- a/restService/images.py Wed Aug 28 12:57:36 2013 +0200 +++ b/restService/images.py Wed Oct 23 12:28:22 2013 +0200 @@ -36,7 +36,6 @@ path=doc.get('TT_image',None) - if (path is not None) and (not isinstance(path, basestring)): #TT_image was defined as multiple , shouldn't be the case ? path=path[0] diff -r aced422ae66c -r d3ecbfd21e06 restService/templates/serviceDescription.html --- a/restService/templates/serviceDescription.html Wed Aug 28 12:57:36 2013 +0200 +++ b/restService/templates/serviceDescription.html Wed Oct 23 12:28:22 2013 +0200 @@ -54,7 +54,7 @@ GET: returns an simple web page to enter username and amount of purls needed -POST: expects the parameter "username" and "amount"", return list of purls +POST: expects the parameter "userName" and "amount"", return list of purls

/purls/searchSolr?text-url-path=PATH