Mercurial > hg > ChinaGisRestApi
changeset 46:3ea606bae008
starting JSON store
author | casties |
---|---|
date | Fri, 03 Sep 2010 12:38:22 +0200 |
parents | ed8db63fab4f |
children | 2ba80c8bb47f |
files | RestDbJsonStore.py |
diffstat | 1 files changed, 7 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/RestDbJsonStore.py Thu Sep 02 17:01:52 2010 +0200 +++ b/RestDbJsonStore.py Fri Sep 03 12:38:22 2010 +0200 @@ -22,14 +22,12 @@ class RestDbJsonStore(RestDbInterface): - """Object for RESTful database queries - path schema: /db/{schema}/{table}/ - omitting table gives a list of schemas - omitting table and schema gives a list of schemas + """Object for RESTful access to JSON objects + path schema: /db/{schema}/{table}/{tag}/{type}/{item} """ implements(IPublishTraverse) - meta_type="RESTdbJSONStore" + meta_type="RESTjson" manage_options=Folder.manage_options+( {'label':'Config','action':'manage_editRestDbJsonStoreForm'}, ) @@ -43,16 +41,6 @@ self.REQUEST.RESPONSE.setHeader("Content-Type", "application/json") json.dump(data, self.REQUEST.RESPONSE) - def JSON_schema(self,data,schema): - """JSON index function""" - self.REQUEST.RESPONSE.setHeader("Content-Type", "application/json") - json.dump(data, self.REQUEST.RESPONSE) - - def JSON_schema_table(self,data,tablename): - """JSON index function""" - self.REQUEST.RESPONSE.setHeader("Content-Type", "application/json") - json.dump(data, self.REQUEST.RESPONSE) - def __init__(self, id, title, connection_id=None): """init""" @@ -116,10 +104,10 @@ if pt is not None: return pt(format=resultFormat,type=queryType,path=path) - if len(path) == 1: - # list of schemas - return self.showListOfSchemas(resultFormat=resultFormat) - elif len(path) == 2: + if len(path) == 3: + # list of tags + return self.showListOfTags(resultFormat=resultFormat,schema=path[1],table=path[2]) + elif len(path) == 4: # list of tables return self.showListOfTables(resultFormat=resultFormat,schema=path[1]) elif len(path) == 3: