# HG changeset patch # User casties # Date 1283851619 -7200 # Node ID e4828cb72ce2211b5664674e808041233f932609 # Parent 2ba80c8bb47f14fdc79fb6f84660b8d396c549d0 working on json store diff -r 2ba80c8bb47f -r e4828cb72ce2 RestDbJsonStore.py --- a/RestDbJsonStore.py Fri Sep 03 14:01:47 2010 +0200 +++ b/RestDbJsonStore.py Tue Sep 07 11:26:59 2010 +0200 @@ -108,15 +108,14 @@ # 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: - # table - if REQUEST.get("method") == "POST" and REQUEST.get("create_table_file",None) is not None: - # POST to table to check - return self.checkTable(resultFormat=resultFormat,schema=path[1],table=path[2]) - # else show table - return self.showTable(resultFormat=resultFormat,schema=path[1],table=path[2]) + # list of types + return self.showListOfTypes(resultFormat=resultFormat,schema=path[1],table=path[2],tag=path[3]) + elif len(path) == 5: + # list of types + return self.showListOfItems(resultFormat=resultFormat,schema=path[1],table=path[2],tag=path[3],type=path[4]) + elif len(path) == 6: + # show item + return self.showItem(resultFormat=resultFormat,schema=path[1],table=path[2],tag=path[3],type=path[4],item=path[5]) # don't know what to do return str(REQUEST) @@ -125,12 +124,12 @@ """ Implement WebDAV/HTTP PUT/FTP put method for this object. """ - logging.debug("RestDbInterface PUT") + path = REQUEST.get('restdb_path',[]) + logging.debug("RestDbInterface PUT (path=%s)"%repr(path)) #logging.debug("req=%s"%REQUEST) #self.dav__init(REQUEST, RESPONSE) #self.dav__simpleifhandler(REQUEST, RESPONSE) # ReST path was stored in request - path = REQUEST.get('restdb_path',[]) if len(path) == 3: schema = path[1] tablename = path[2] @@ -164,7 +163,17 @@ RESPONSE.setStatus(400) return + def showListOfTags(self,resultFormat,schema,table): + """returns the list of existing tags""" + logging.debug("showlistoftags schema=%s table=%s"%(schema,table)) + sql = 'select distinct gui_tags from "%s"."%s"'%(schema,table) + res = self.executeSQL(sql) + if len(res['rows']) > 0: + tags = [r[0] for r in rows] + return tags + return [] + manage_addRestDbInterfaceForm=PageTemplateFile('zpt/addRestDbInterface',globals()) def manage_addRestDbInterface(self, id, title='', label='', description='',