comparison RestDbInterface.py @ 20:67ca17753cd5

NEW - # 12: create table and upload data https://it-dev.mpiwg-berlin.mpg.de/tracs/GIS/ticket/12
author casties
date Wed, 18 Aug 2010 16:20:25 +0200
parents 060797795a4d
children a67b7c1f7ec5
comparison
equal deleted inserted replaced
18:060797795a4d 20:67ca17753cd5
213 RESPONSE.setStatus(400) 213 RESPONSE.setStatus(400)
214 return 214 return
215 215
216 logging.debug("put with schema=%s table=%s file=%s"%(schema,tablename,file)) 216 logging.debug("put with schema=%s table=%s file=%s"%(schema,tablename,file))
217 ret = self.createTableFromXML(schema, tablename, file) 217 ret = self.createTableFromXML(schema, tablename, file)
218 # set content type to json(?) 218 resultType = REQUEST.get("result_type","application/json")
219 json.dump(ret, RESPONSE) 219 if resultType == "application/json":
220 RESPONSE.setHeader("Content-Type", "application/json")
221 json.dump(ret, RESPONSE)
222 elif resultType == "html/json":
223 RESPONSE.setHeader("Content-Type", "text/html")
224 RESPONSE.write("<html>\n<body>\n<pre>")
225 json.dump(ret, RESPONSE)
226 RESPONSE.write("</pre>\n</body>\n</html>")
227
220 228
221 else: 229 else:
222 # 400 Bad Request 230 # 400 Bad Request
223 RESPONSE.setStatus(400) 231 RESPONSE.setStatus(400)
224 return 232 return