# HG changeset patch # User casties # Date 1283510302 -7200 # Node ID 3ea606bae008a71b27b3e04c37c0522ee3eebf6a # Parent ed8db63fab4f1fd41d290edea4e9aebe49e9e663 starting JSON store diff -r ed8db63fab4f -r 3ea606bae008 RestDbJsonStore.py --- 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: