annotate RestDbInterface.py @ 22:7ee835840724 default tip

fix problem with config page when autocommit is not defined.
author casties
date Wed, 24 Apr 2013 20:49:42 +0200
parents 60fea3a6c695
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
09361041be51 first checkin
casties
parents:
diff changeset
1 '''
09361041be51 first checkin
casties
parents:
diff changeset
2 Created on 19.5.2010
09361041be51 first checkin
casties
parents:
diff changeset
3
09361041be51 first checkin
casties
parents:
diff changeset
4 @author: casties
09361041be51 first checkin
casties
parents:
diff changeset
5 '''
09361041be51 first checkin
casties
parents:
diff changeset
6
09361041be51 first checkin
casties
parents:
diff changeset
7 from OFS.Folder import Folder
09361041be51 first checkin
casties
parents:
diff changeset
8 from Products.PageTemplates.PageTemplateFile import PageTemplateFile
09361041be51 first checkin
casties
parents:
diff changeset
9 from AccessControl import getSecurityManager, Unauthorized
09361041be51 first checkin
casties
parents:
diff changeset
10 import logging
09361041be51 first checkin
casties
parents:
diff changeset
11 import re
09361041be51 first checkin
casties
parents:
diff changeset
12 import json
09361041be51 first checkin
casties
parents:
diff changeset
13 import time
09361041be51 first checkin
casties
parents:
diff changeset
14
09361041be51 first checkin
casties
parents:
diff changeset
15 from zope.interface import implements
09361041be51 first checkin
casties
parents:
diff changeset
16 from zope.publisher.interfaces import IPublishTraverse
09361041be51 first checkin
casties
parents:
diff changeset
17 from ZPublisher.BaseRequest import DefaultPublishTraverse
09361041be51 first checkin
casties
parents:
diff changeset
18
3
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents: 2
diff changeset
19 from DBInterface import *
0
09361041be51 first checkin
casties
parents:
diff changeset
20
09361041be51 first checkin
casties
parents:
diff changeset
21
3
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents: 2
diff changeset
22 class RestDbInterface(DBInterface, Folder):
0
09361041be51 first checkin
casties
parents:
diff changeset
23 """Object for RESTful database queries
09361041be51 first checkin
casties
parents:
diff changeset
24 path schema: /db/{schema}/{table}/
09361041be51 first checkin
casties
parents:
diff changeset
25 omitting table gives a list of schemas
09361041be51 first checkin
casties
parents:
diff changeset
26 omitting table and schema gives a list of schemas
09361041be51 first checkin
casties
parents:
diff changeset
27 """
09361041be51 first checkin
casties
parents:
diff changeset
28 implements(IPublishTraverse)
09361041be51 first checkin
casties
parents:
diff changeset
29
17
48ed91b29784 added stuff from RestDbGisApi to WritableRestDbInterface.
casties
parents: 3
diff changeset
30 meta_type="RESTdb"
0
09361041be51 first checkin
casties
parents:
diff changeset
31 manage_options=Folder.manage_options+(
09361041be51 first checkin
casties
parents:
diff changeset
32 {'label':'Config','action':'manage_editRestDbInterfaceForm'},
09361041be51 first checkin
casties
parents:
diff changeset
33 )
09361041be51 first checkin
casties
parents:
diff changeset
34
09361041be51 first checkin
casties
parents:
diff changeset
35 # management templates
09361041be51 first checkin
casties
parents:
diff changeset
36 manage_editRestDbInterfaceForm=PageTemplateFile('zpt/editRestDbInterface',globals())
09361041be51 first checkin
casties
parents:
diff changeset
37
09361041be51 first checkin
casties
parents:
diff changeset
38 # data templates
09361041be51 first checkin
casties
parents:
diff changeset
39 XML_index = PageTemplateFile('zpt/XML_index', globals())
09361041be51 first checkin
casties
parents:
diff changeset
40 XML_schema = PageTemplateFile('zpt/XML_schema', globals())
09361041be51 first checkin
casties
parents:
diff changeset
41 XML_schema_table = PageTemplateFile('zpt/XML_schema_table', globals())
09361041be51 first checkin
casties
parents:
diff changeset
42 HTML_index = PageTemplateFile('zpt/HTML_index', globals())
09361041be51 first checkin
casties
parents:
diff changeset
43 HTML_schema = PageTemplateFile('zpt/HTML_schema', globals())
09361041be51 first checkin
casties
parents:
diff changeset
44 HTML_schema_table = PageTemplateFile('zpt/HTML_schema_table', globals())
09361041be51 first checkin
casties
parents:
diff changeset
45 JSONHTML_index = PageTemplateFile('zpt/JSONHTML_index', globals())
09361041be51 first checkin
casties
parents:
diff changeset
46 JSONHTML_schema = PageTemplateFile('zpt/JSONHTML_schema', globals())
09361041be51 first checkin
casties
parents:
diff changeset
47 JSONHTML_schema_table = PageTemplateFile('zpt/JSONHTML_schema_table', globals())
09361041be51 first checkin
casties
parents:
diff changeset
48 # JSON_* templates are scripts
09361041be51 first checkin
casties
parents:
diff changeset
49 def JSON_index(self):
09361041be51 first checkin
casties
parents:
diff changeset
50 """JSON index function"""
09361041be51 first checkin
casties
parents:
diff changeset
51 self.REQUEST.RESPONSE.setHeader("Content-Type", "application/json")
09361041be51 first checkin
casties
parents:
diff changeset
52 json.dump(self.getListOfSchemas(), self.REQUEST.RESPONSE)
09361041be51 first checkin
casties
parents:
diff changeset
53
09361041be51 first checkin
casties
parents:
diff changeset
54 def JSON_schema(self,schema):
09361041be51 first checkin
casties
parents:
diff changeset
55 """JSON index function"""
09361041be51 first checkin
casties
parents:
diff changeset
56 self.REQUEST.RESPONSE.setHeader("Content-Type", "application/json")
09361041be51 first checkin
casties
parents:
diff changeset
57 json.dump(self.getListOfTables(schema), self.REQUEST.RESPONSE)
09361041be51 first checkin
casties
parents:
diff changeset
58
09361041be51 first checkin
casties
parents:
diff changeset
59 def JSON_schema_table(self,schema,table):
09361041be51 first checkin
casties
parents:
diff changeset
60 """JSON index function"""
09361041be51 first checkin
casties
parents:
diff changeset
61 self.REQUEST.RESPONSE.setHeader("Content-Type", "application/json")
09361041be51 first checkin
casties
parents:
diff changeset
62 json.dump(self.getTable(schema, table), self.REQUEST.RESPONSE)
09361041be51 first checkin
casties
parents:
diff changeset
63
09361041be51 first checkin
casties
parents:
diff changeset
64
09361041be51 first checkin
casties
parents:
diff changeset
65 def __init__(self, id, title, connection_id=None):
09361041be51 first checkin
casties
parents:
diff changeset
66 """init"""
09361041be51 first checkin
casties
parents:
diff changeset
67 self.id = id
09361041be51 first checkin
casties
parents:
diff changeset
68 self.title = title
09361041be51 first checkin
casties
parents:
diff changeset
69 # database connection id
09361041be51 first checkin
casties
parents:
diff changeset
70 self.connection_id = connection_id
09361041be51 first checkin
casties
parents:
diff changeset
71 # create template folder
09361041be51 first checkin
casties
parents:
diff changeset
72 self.manage_addFolder('template')
09361041be51 first checkin
casties
parents:
diff changeset
73
09361041be51 first checkin
casties
parents:
diff changeset
74
09361041be51 first checkin
casties
parents:
diff changeset
75 def getRestDbUrl(self):
09361041be51 first checkin
casties
parents:
diff changeset
76 """returns url to the RestDb instance"""
09361041be51 first checkin
casties
parents:
diff changeset
77 return self.absolute_url()
09361041be51 first checkin
casties
parents:
diff changeset
78
09361041be51 first checkin
casties
parents:
diff changeset
79 def getJsonString(self,object):
09361041be51 first checkin
casties
parents:
diff changeset
80 """returns a JSON formatted string from object"""
09361041be51 first checkin
casties
parents:
diff changeset
81 return json.dumps(object)
09361041be51 first checkin
casties
parents:
diff changeset
82
09361041be51 first checkin
casties
parents:
diff changeset
83
09361041be51 first checkin
casties
parents:
diff changeset
84 def isAllowed(self,action,schema,table,user=None):
09361041be51 first checkin
casties
parents:
diff changeset
85 """returns if the requested action on the table is allowed"""
09361041be51 first checkin
casties
parents:
diff changeset
86 if user is None:
09361041be51 first checkin
casties
parents:
diff changeset
87 user = self.REQUEST.get('AUTHENTICATED_USER',None)
09361041be51 first checkin
casties
parents:
diff changeset
88 logging.debug("isAllowed action=%s schema=%s table=%s user=%s"%(action,schema,table,user))
09361041be51 first checkin
casties
parents:
diff changeset
89 # no default policy!
09361041be51 first checkin
casties
parents:
diff changeset
90 return True
09361041be51 first checkin
casties
parents:
diff changeset
91
09361041be51 first checkin
casties
parents:
diff changeset
92
09361041be51 first checkin
casties
parents:
diff changeset
93 def publishTraverse(self,request,name):
09361041be51 first checkin
casties
parents:
diff changeset
94 """change the traversal"""
09361041be51 first checkin
casties
parents:
diff changeset
95 # get stored path
09361041be51 first checkin
casties
parents:
diff changeset
96 path = request.get('restdb_path', [])
09361041be51 first checkin
casties
parents:
diff changeset
97 logging.debug("publishtraverse: name=%s restdb_path=%s"%(name,path))
09361041be51 first checkin
casties
parents:
diff changeset
98
09361041be51 first checkin
casties
parents:
diff changeset
99 if name in ("index_html", "PUT"):
09361041be51 first checkin
casties
parents:
diff changeset
100 # end of traversal
09361041be51 first checkin
casties
parents:
diff changeset
101 if request.get("method") == "POST" and request.get("action",None) == "PUT":
09361041be51 first checkin
casties
parents:
diff changeset
102 # fake PUT by POST with action=PUT
09361041be51 first checkin
casties
parents:
diff changeset
103 name = "PUT"
09361041be51 first checkin
casties
parents:
diff changeset
104
09361041be51 first checkin
casties
parents:
diff changeset
105 return getattr(self, name)
09361041be51 first checkin
casties
parents:
diff changeset
106 #TODO: should we check more?
09361041be51 first checkin
casties
parents:
diff changeset
107 else:
09361041be51 first checkin
casties
parents:
diff changeset
108 # traverse
09361041be51 first checkin
casties
parents:
diff changeset
109 if len(path) == 0:
09361041be51 first checkin
casties
parents:
diff changeset
110 # first segment
09361041be51 first checkin
casties
parents:
diff changeset
111 if name == 'db':
09361041be51 first checkin
casties
parents:
diff changeset
112 # virtual path -- continue traversing
09361041be51 first checkin
casties
parents:
diff changeset
113 path = [name]
09361041be51 first checkin
casties
parents:
diff changeset
114 request['restdb_path'] = path
09361041be51 first checkin
casties
parents:
diff changeset
115 else:
09361041be51 first checkin
casties
parents:
diff changeset
116 # try real path
09361041be51 first checkin
casties
parents:
diff changeset
117 tr = DefaultPublishTraverse(self, request)
09361041be51 first checkin
casties
parents:
diff changeset
118 ob = tr.publishTraverse(request, name)
09361041be51 first checkin
casties
parents:
diff changeset
119 return ob
09361041be51 first checkin
casties
parents:
diff changeset
120 else:
09361041be51 first checkin
casties
parents:
diff changeset
121 path.append(name)
09361041be51 first checkin
casties
parents:
diff changeset
122
09361041be51 first checkin
casties
parents:
diff changeset
123 # continue traversing
09361041be51 first checkin
casties
parents:
diff changeset
124 return self
09361041be51 first checkin
casties
parents:
diff changeset
125
09361041be51 first checkin
casties
parents:
diff changeset
126 def index_html(self,REQUEST,RESPONSE):
09361041be51 first checkin
casties
parents:
diff changeset
127 """index method"""
09361041be51 first checkin
casties
parents:
diff changeset
128 # ReST path was stored in request
09361041be51 first checkin
casties
parents:
diff changeset
129 path = REQUEST.get('restdb_path',[])
09361041be51 first checkin
casties
parents:
diff changeset
130
09361041be51 first checkin
casties
parents:
diff changeset
131 # type and format are real parameter
09361041be51 first checkin
casties
parents:
diff changeset
132 resultFormat = REQUEST.get('format','HTML').upper()
09361041be51 first checkin
casties
parents:
diff changeset
133 queryType = REQUEST.get('type',None)
09361041be51 first checkin
casties
parents:
diff changeset
134
09361041be51 first checkin
casties
parents:
diff changeset
135 logging.debug("index_html path=%s resultFormat=%s queryType=%s"%(path,resultFormat,queryType))
09361041be51 first checkin
casties
parents:
diff changeset
136
09361041be51 first checkin
casties
parents:
diff changeset
137 if queryType is not None:
09361041be51 first checkin
casties
parents:
diff changeset
138 # non-empty queryType -- look for template
09361041be51 first checkin
casties
parents:
diff changeset
139 pt = getattr(self.template, "%s_%s"%(resultFormat,queryType), None)
09361041be51 first checkin
casties
parents:
diff changeset
140 if pt is not None:
09361041be51 first checkin
casties
parents:
diff changeset
141 return pt(format=resultFormat,type=queryType,path=path)
09361041be51 first checkin
casties
parents:
diff changeset
142
09361041be51 first checkin
casties
parents:
diff changeset
143 if len(path) == 1:
09361041be51 first checkin
casties
parents:
diff changeset
144 # list of schemas
09361041be51 first checkin
casties
parents:
diff changeset
145 return self.showListOfSchemas(format=resultFormat)
09361041be51 first checkin
casties
parents:
diff changeset
146 elif len(path) == 2:
09361041be51 first checkin
casties
parents:
diff changeset
147 # list of tables
09361041be51 first checkin
casties
parents:
diff changeset
148 return self.showListOfTables(format=resultFormat,schema=path[1])
09361041be51 first checkin
casties
parents:
diff changeset
149 elif len(path) == 3:
09361041be51 first checkin
casties
parents:
diff changeset
150 # table
09361041be51 first checkin
casties
parents:
diff changeset
151 if REQUEST.get("method") == "POST" and REQUEST.get("create_table_file",None) is not None:
09361041be51 first checkin
casties
parents:
diff changeset
152 # POST to table to check
09361041be51 first checkin
casties
parents:
diff changeset
153 return self.checkTable(format=resultFormat,schema=path[1],table=path[2])
09361041be51 first checkin
casties
parents:
diff changeset
154 # else show table
09361041be51 first checkin
casties
parents:
diff changeset
155 return self.showTable(format=resultFormat,schema=path[1],table=path[2])
09361041be51 first checkin
casties
parents:
diff changeset
156
09361041be51 first checkin
casties
parents:
diff changeset
157 # don't know what to do
09361041be51 first checkin
casties
parents:
diff changeset
158 return str(REQUEST)
09361041be51 first checkin
casties
parents:
diff changeset
159
09361041be51 first checkin
casties
parents:
diff changeset
160 def showTable(self,format='XML',schema='public',table=None,REQUEST=None,RESPONSE=None):
09361041be51 first checkin
casties
parents:
diff changeset
161 """returns PageTemplate with tables"""
09361041be51 first checkin
casties
parents:
diff changeset
162 logging.debug("showtable")
09361041be51 first checkin
casties
parents:
diff changeset
163 if REQUEST is None:
09361041be51 first checkin
casties
parents:
diff changeset
164 REQUEST = self.REQUEST
09361041be51 first checkin
casties
parents:
diff changeset
165
09361041be51 first checkin
casties
parents:
diff changeset
166 # should be cross-site accessible
09361041be51 first checkin
casties
parents:
diff changeset
167 if RESPONSE is None:
09361041be51 first checkin
casties
parents:
diff changeset
168 RESPONSE = self.REQUEST.RESPONSE
09361041be51 first checkin
casties
parents:
diff changeset
169
09361041be51 first checkin
casties
parents:
diff changeset
170 RESPONSE.setHeader('Access-Control-Allow-Origin', '*')
09361041be51 first checkin
casties
parents:
diff changeset
171
09361041be51 first checkin
casties
parents:
diff changeset
172 # everything else has its own template
09361041be51 first checkin
casties
parents:
diff changeset
173 pt = getattr(self.template, '%s_schema_table'%format, None)
09361041be51 first checkin
casties
parents:
diff changeset
174 if pt is None:
09361041be51 first checkin
casties
parents:
diff changeset
175 return "ERROR!! template %s_schema_table not found"%format
09361041be51 first checkin
casties
parents:
diff changeset
176
09361041be51 first checkin
casties
parents:
diff changeset
177 #data = self.getTable(schema,table)
09361041be51 first checkin
casties
parents:
diff changeset
178 return pt(schema=schema,table=table)
09361041be51 first checkin
casties
parents:
diff changeset
179
09361041be51 first checkin
casties
parents:
diff changeset
180 def getTable(self,schema='public',table=None,sortBy=1,username='guest'):
09361041be51 first checkin
casties
parents:
diff changeset
181 """return table data"""
09361041be51 first checkin
casties
parents:
diff changeset
182 logging.debug("gettable")
09361041be51 first checkin
casties
parents:
diff changeset
183 if sortBy:
18
60fea3a6c695 better fix for psycopg 2.4. better quoting of sql arguments.
casties
parents: 17
diff changeset
184 data = self.executeSQL('select * from "%s"."%s" order by %%s'%(sqlName(schema),sqlName(table)),(sortBy,))
0
09361041be51 first checkin
casties
parents:
diff changeset
185 else:
18
60fea3a6c695 better fix for psycopg 2.4. better quoting of sql arguments.
casties
parents: 17
diff changeset
186 data = self.executeSQL('select * from "%s"."%s"'%(sqlName(schema),sqlName(table)))
0
09361041be51 first checkin
casties
parents:
diff changeset
187 return data
09361041be51 first checkin
casties
parents:
diff changeset
188
09361041be51 first checkin
casties
parents:
diff changeset
189 def hasTable(self,schema='public',table=None,username='guest'):
09361041be51 first checkin
casties
parents:
diff changeset
190 """return if table exists"""
09361041be51 first checkin
casties
parents:
diff changeset
191 logging.debug("hastable")
09361041be51 first checkin
casties
parents:
diff changeset
192 data = self.executeSQL('select 1 from information_schema.tables where table_schema=%s and table_name=%s',(schema,table))
09361041be51 first checkin
casties
parents:
diff changeset
193 ret = bool(data['rows'])
09361041be51 first checkin
casties
parents:
diff changeset
194 return ret
09361041be51 first checkin
casties
parents:
diff changeset
195
09361041be51 first checkin
casties
parents:
diff changeset
196 def showListOfTables(self,format='XML',schema='public',REQUEST=None,RESPONSE=None):
09361041be51 first checkin
casties
parents:
diff changeset
197 """returns PageTemplate with list of tables"""
09361041be51 first checkin
casties
parents:
diff changeset
198 logging.debug("showlistoftables")
09361041be51 first checkin
casties
parents:
diff changeset
199 # should be cross-site accessible
09361041be51 first checkin
casties
parents:
diff changeset
200 if RESPONSE is None:
09361041be51 first checkin
casties
parents:
diff changeset
201 RESPONSE = self.REQUEST.RESPONSE
09361041be51 first checkin
casties
parents:
diff changeset
202 RESPONSE.setHeader('Access-Control-Allow-Origin', '*')
09361041be51 first checkin
casties
parents:
diff changeset
203
09361041be51 first checkin
casties
parents:
diff changeset
204 pt = getattr(self.template, '%s_schema'%format, None)
09361041be51 first checkin
casties
parents:
diff changeset
205 if pt is None:
09361041be51 first checkin
casties
parents:
diff changeset
206 return "ERROR!! template %s_schema not found"%format
09361041be51 first checkin
casties
parents:
diff changeset
207
09361041be51 first checkin
casties
parents:
diff changeset
208 #data = self.getListOfTables(schema)
09361041be51 first checkin
casties
parents:
diff changeset
209 return pt(schema=schema)
09361041be51 first checkin
casties
parents:
diff changeset
210
09361041be51 first checkin
casties
parents:
diff changeset
211 def getListOfTables(self,schema='public',username='guest'):
09361041be51 first checkin
casties
parents:
diff changeset
212 """return list of tables"""
09361041be51 first checkin
casties
parents:
diff changeset
213 logging.debug("getlistoftables")
09361041be51 first checkin
casties
parents:
diff changeset
214 # get list of fields and types of db table
09361041be51 first checkin
casties
parents:
diff changeset
215 #qstr="""SELECT c.relname AS tablename FROM pg_catalog.pg_class c
09361041be51 first checkin
casties
parents:
diff changeset
216 # LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
09361041be51 first checkin
casties
parents:
diff changeset
217 # WHERE c.relkind IN ('r','') AND n.nspname NOT IN ('pg_catalog', 'pg_toast')
09361041be51 first checkin
casties
parents:
diff changeset
218 # AND pg_catalog.pg_table_is_visible(c.oid)
09361041be51 first checkin
casties
parents:
diff changeset
219 # AND c.relname ORDER BY 1"""
09361041be51 first checkin
casties
parents:
diff changeset
220 qstr = """SELECT table_name FROM information_schema.tables WHERE table_type = 'BASE TABLE'
09361041be51 first checkin
casties
parents:
diff changeset
221 AND table_schema = %s ORDER BY 1"""
09361041be51 first checkin
casties
parents:
diff changeset
222 data=self.executeSQL(qstr,(schema,))
09361041be51 first checkin
casties
parents:
diff changeset
223 return data
09361041be51 first checkin
casties
parents:
diff changeset
224
09361041be51 first checkin
casties
parents:
diff changeset
225 def showListOfSchemas(self,format='XML',REQUEST=None,RESPONSE=None):
09361041be51 first checkin
casties
parents:
diff changeset
226 """returns PageTemplate with list of schemas"""
09361041be51 first checkin
casties
parents:
diff changeset
227 logging.debug("showlistofschemas")
09361041be51 first checkin
casties
parents:
diff changeset
228 # should be cross-site accessible
09361041be51 first checkin
casties
parents:
diff changeset
229 if RESPONSE is None:
09361041be51 first checkin
casties
parents:
diff changeset
230 RESPONSE = self.REQUEST.RESPONSE
09361041be51 first checkin
casties
parents:
diff changeset
231 RESPONSE.setHeader('Access-Control-Allow-Origin', '*')
09361041be51 first checkin
casties
parents:
diff changeset
232
09361041be51 first checkin
casties
parents:
diff changeset
233 pt = getattr(self.template, '%s_index'%format, None)
09361041be51 first checkin
casties
parents:
diff changeset
234 if pt is None:
09361041be51 first checkin
casties
parents:
diff changeset
235 return "ERROR!! template %s_index not found"%format
09361041be51 first checkin
casties
parents:
diff changeset
236
09361041be51 first checkin
casties
parents:
diff changeset
237 #data = self.getListOfSchemas()
09361041be51 first checkin
casties
parents:
diff changeset
238 return pt()
09361041be51 first checkin
casties
parents:
diff changeset
239
09361041be51 first checkin
casties
parents:
diff changeset
240 def getListOfSchemas(self,username='guest'):
09361041be51 first checkin
casties
parents:
diff changeset
241 """return list of schemas"""
09361041be51 first checkin
casties
parents:
diff changeset
242 logging.debug("getlistofschemas")
09361041be51 first checkin
casties
parents:
diff changeset
243 # TODO: really look up schemas
09361041be51 first checkin
casties
parents:
diff changeset
244 data={'fields': (('schemas',),), 'rows': [('public',),]}
09361041be51 first checkin
casties
parents:
diff changeset
245 return data
09361041be51 first checkin
casties
parents:
diff changeset
246
09361041be51 first checkin
casties
parents:
diff changeset
247 def manage_editRestDbInterface(self, title=None, connection_id=None,
09361041be51 first checkin
casties
parents:
diff changeset
248 REQUEST=None):
09361041be51 first checkin
casties
parents:
diff changeset
249 """Change the object"""
09361041be51 first checkin
casties
parents:
diff changeset
250 if title is not None:
09361041be51 first checkin
casties
parents:
diff changeset
251 self.title = title
09361041be51 first checkin
casties
parents:
diff changeset
252
09361041be51 first checkin
casties
parents:
diff changeset
253 if connection_id is not None:
09361041be51 first checkin
casties
parents:
diff changeset
254 self.connection_id = connection_id
09361041be51 first checkin
casties
parents:
diff changeset
255
09361041be51 first checkin
casties
parents:
diff changeset
256 #checkPermission=getSecurityManager().checkPermission
09361041be51 first checkin
casties
parents:
diff changeset
257 REQUEST.RESPONSE.redirect('manage_main')
09361041be51 first checkin
casties
parents:
diff changeset
258
09361041be51 first checkin
casties
parents:
diff changeset
259
09361041be51 first checkin
casties
parents:
diff changeset
260 manage_addRestDbInterfaceForm=PageTemplateFile('zpt/addRestDbInterface',globals())
09361041be51 first checkin
casties
parents:
diff changeset
261
09361041be51 first checkin
casties
parents:
diff changeset
262 def manage_addRestDbInterface(self, id, title='', label='', description='',
09361041be51 first checkin
casties
parents:
diff changeset
263 createPublic=0,
09361041be51 first checkin
casties
parents:
diff changeset
264 createUserF=0,
09361041be51 first checkin
casties
parents:
diff changeset
265 REQUEST=None):
09361041be51 first checkin
casties
parents:
diff changeset
266 """Add a new object with id *id*."""
09361041be51 first checkin
casties
parents:
diff changeset
267
09361041be51 first checkin
casties
parents:
diff changeset
268 ob=RestDbInterface(str(id),title)
09361041be51 first checkin
casties
parents:
diff changeset
269 self._setObject(id, ob)
09361041be51 first checkin
casties
parents:
diff changeset
270
09361041be51 first checkin
casties
parents:
diff changeset
271 #checkPermission=getSecurityManager().checkPermission
09361041be51 first checkin
casties
parents:
diff changeset
272 REQUEST.RESPONSE.redirect('manage_main')
09361041be51 first checkin
casties
parents:
diff changeset
273
09361041be51 first checkin
casties
parents:
diff changeset
274