Mercurial > hg > ChinaGisRestApi
comparison RestDbJsonStore.py @ 70:9ec7e32e8ad3
working on maps
nicer HTML (with xhtml DTD)
better unicode handling for psycopg
author | casties |
---|---|
date | Tue, 23 Nov 2010 17:16:25 +0100 |
parents | 54940a99f12d |
children | 4ade9b80b563 |
comparison
equal
deleted
inserted
replaced
69:752ce3dfd23e | 70:9ec7e32e8ad3 |
---|---|
197 recursive = self.REQUEST.get("recursive", False) | 197 recursive = self.REQUEST.get("recursive", False) |
198 if recursive: | 198 if recursive: |
199 items = self.getListOfItemsAndValues(schema, table, tag, type) | 199 items = self.getListOfItemsAndValues(schema, table, tag, type) |
200 # items contain JSON-strings | 200 # items contain JSON-strings |
201 its = ",".join(['{"key":"%s","val":%s}'%(i[0],i[1]) for i in items]) | 201 its = ",".join(['{"key":"%s","val":%s}'%(i[0],i[1]) for i in items]) |
202 its = "["+its+"]" | 202 its = "[%s]"%its |
203 if resultFormat == 'JSON': | 203 if resultFormat == 'JSON': |
204 self.REQUEST.RESPONSE.setHeader("Content-Type", "application/json") | 204 self.REQUEST.RESPONSE.setHeader("Content-Type", "application/json") |
205 self.REQUEST.RESPONSE.write(its) | 205 # we assume utf-8 |
206 self.REQUEST.RESPONSE.write(utf8ify(its)) | |
206 else: | 207 else: |
207 self.REQUEST.RESPONSE.write(its) | 208 # we assume utf-8 |
209 self.REQUEST.RESPONSE.write(utf8ify(its)) | |
208 | 210 |
209 else: | 211 else: |
210 items = self.getListOfItems(schema, table, tag, type) | 212 items = self.getListOfItems(schema, table, tag, type) |
211 if resultFormat == 'JSON': | 213 if resultFormat == 'JSON': |
212 self.REQUEST.RESPONSE.setHeader("Content-Type", "application/json") | 214 self.REQUEST.RESPONSE.setHeader("Content-Type", "application/json") |