annotate ZDBInterfaceFolder.py @ 9:87087f4f4059

fixed bug with default sort order.
author root@xserve09.mpiwg-berlin.mpg.de
date Thu, 17 Feb 2011 20:18:18 +0100
parents 17b19345d011
children 283c01ebe96e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
1 '''
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
2 Created on 14.2.2011
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
3
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
4 @author: casties
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
5 '''
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
6
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
7 from OFS.Folder import Folder
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
8 from Products.PageTemplates.PageTemplateFile import PageTemplateFile
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
9 from AccessControl import getSecurityManager, Unauthorized
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
10 import logging
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
11 import re
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
12
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
13 from DBInterface import *
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
14
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
15
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
16 class ZDBInterfaceFolder(DBInterface, Folder):
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
17 """Folder for database queries
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
18 """
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
19
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
20 meta_type="ZDBInterfaceFolder"
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
21 manage_options=Folder.manage_options+(
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
22 {'label':'Config','action':'manage_editZDBInterfaceFolderForm'},
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
23 )
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
24
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
25 # management templates
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
26 manage_editZDBInterfaceFolderForm=PageTemplateFile('zpt/editZDBInterfaceFolder',globals())
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
27
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
28
9
87087f4f4059 fixed bug with default sort order.
root@xserve09.mpiwg-berlin.mpg.de
parents: 8
diff changeset
29 def __init__(self, id, title, connection_id=None, autocommit=False, default_search='bw'):
3
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
30 """init"""
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
31 self.id = id
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
32 self.title = title
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
33 # database connection id
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
34 self.connection_id = connection_id
9
87087f4f4059 fixed bug with default sort order.
root@xserve09.mpiwg-berlin.mpg.de
parents: 8
diff changeset
35 # set db connection to autocommit
8
17b19345d011 added autocommit option.
casties
parents: 7
diff changeset
36 self.autocommit = autocommit
9
87087f4f4059 fixed bug with default sort order.
root@xserve09.mpiwg-berlin.mpg.de
parents: 8
diff changeset
37 # default text search mode
87087f4f4059 fixed bug with default sort order.
root@xserve09.mpiwg-berlin.mpg.de
parents: 8
diff changeset
38 self.default_search = default_search
3
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
39
5
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
40 def getSQLQuery(self, table, argv):
4
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
41 """returns dict with SQL query string and args"""
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
42 logging.debug("getSQLquery table=%s argv=%s"%(table,argv))
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
43 args = []
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
44 select = "*"
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
45 order = None
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
46 wheres = []
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
47 whereOp = "AND"
8
17b19345d011 added autocommit option.
casties
parents: 7
diff changeset
48 processed = {}
17b19345d011 added autocommit option.
casties
parents: 7
diff changeset
49 unprocessed = {}
7
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
50 limit = None
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
51 offset = None
5
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
52
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
53 def doOp(op, param, val):
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
54 # handles comparison operations in WHERE clause
7
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
55 logging.debug("doop op=%s param=%s val=%s"%(op,param,val))
5
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
56 if isinstance(val, list):
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
57 # join multiple parameters with spaces (makes sense with checkbox and -op=all)
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
58 val = " ".join(val)
7
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
59
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
60 # string comparisons are case-insensitive
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
61 if isinstance(val, basestring):
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
62 param = "LOWER(%s)"%param
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
63 val = val.lower()
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
64
5
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
65 if op == "eq":
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
66 wheres.append(param + " = %s")
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
67 args.append(val)
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
68 elif op == "lt":
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
69 wheres.append(param + " < %s")
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
70 args.append(val)
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
71 elif op == "gt":
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
72 wheres.append(param + " > %s")
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
73 args.append(val)
9
87087f4f4059 fixed bug with default sort order.
root@xserve09.mpiwg-berlin.mpg.de
parents: 8
diff changeset
74 elif op == "ew":
7
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
75 wheres.append(param + " ILIKE %s")
5
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
76 args.append("%" + val)
9
87087f4f4059 fixed bug with default sort order.
root@xserve09.mpiwg-berlin.mpg.de
parents: 8
diff changeset
77 elif op == "bw":
7
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
78 wheres.append(param + " ILIKE %s")
5
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
79 args.append(val + "%")
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
80 elif op == "ct":
7
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
81 wheres.append(param + " ILIKE %s")
5
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
82 args.append("%" + val + "%")
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
83 elif op == "all":
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
84 words = []
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
85 for word in val.split(" "):
7
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
86 words.append(param + " ILIKE %s")
5
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
87 args.append("%" + word + "%")
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
88 wheres.append("(" + " AND ".join(words) + ")")
7
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
89 elif op == "one":
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
90 words = []
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
91 for word in val.split(" "):
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
92 words.append(param + " ILIKE %s")
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
93 args.append("%" + word + "%")
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
94 wheres.append("(" + " OR ".join(words) + ")")
5
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
95 else:
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
96 logging.error("getSQLquery: unknown op=%s!"%op)
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
97
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
98 return
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
99
4
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
100 # evaluate argv
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
101 for (key, val) in argv.items():
9
87087f4f4059 fixed bug with default sort order.
root@xserve09.mpiwg-berlin.mpg.de
parents: 8
diff changeset
102 logging.debug("process key=%s val=%s"%(key,val))
8
17b19345d011 added autocommit option.
casties
parents: 7
diff changeset
103 if key in processed:
4
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
104 # parameter has been processed
9
87087f4f4059 fixed bug with default sort order.
root@xserve09.mpiwg-berlin.mpg.de
parents: 8
diff changeset
105 logging.debug(" key=%s processed"%(key))
4
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
106 continue
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
107
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
108 # beginning of a command should always be "_"
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
109 if key[0] == "-":
5
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
110 key = "_" + key[1:]
4
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
111
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
112 if key == "_select":
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
113 # SELECT expression
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
114 select = sqlName(val, more="*,")
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
115 elif key == "_sort":
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
116 # sort i.e. ORDER BY expression
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
117 order = sqlName(val, more=",")
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
118 elif key == "_lop":
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
119 # logical operation joining WHERE clauses
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
120 whereOp = sqlName(val)
7
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
121 elif key == "max":
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
122 # number of results
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
123 limit = sqlName(val)
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
124 elif key == "skip":
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
125 # start at result number
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
126 offset = sqlName(val)
4
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
127 elif key[:3] == "_op":
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
128 # operation parameters _op_param=option
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
129 param = sqlName(key[4:])
5
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
130 logging.debug("param=%s key=%s val=%s"%(param,key,val))
4
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
131 if param in argv:
5
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
132 doOp(val, param, argv[param])
8
17b19345d011 added autocommit option.
casties
parents: 7
diff changeset
133 processed[param] = True
4
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
134 else:
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
135 # no corresponding parameter
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
136 logging.error("getSQLquery: param=%s for op not found!"%param)
8
17b19345d011 added autocommit option.
casties
parents: 7
diff changeset
137 else:
17b19345d011 added autocommit option.
casties
parents: 7
diff changeset
138 # parameter=value pair
17b19345d011 added autocommit option.
casties
parents: 7
diff changeset
139 unprocessed[key] = val
4
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
140
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
141 # process remaining parameters (without _op)
8
17b19345d011 added autocommit option.
casties
parents: 7
diff changeset
142 for (key, val) in unprocessed.items():
9
87087f4f4059 fixed bug with default sort order.
root@xserve09.mpiwg-berlin.mpg.de
parents: 8
diff changeset
143 if key not in processed:
87087f4f4059 fixed bug with default sort order.
root@xserve09.mpiwg-berlin.mpg.de
parents: 8
diff changeset
144 param = sqlName(key)
87087f4f4059 fixed bug with default sort order.
root@xserve09.mpiwg-berlin.mpg.de
parents: 8
diff changeset
145 # default operation
87087f4f4059 fixed bug with default sort order.
root@xserve09.mpiwg-berlin.mpg.de
parents: 8
diff changeset
146 doOp(self.default_search, param, val)
4
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
147
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
148 # join it all
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
149 query = "SELECT %s FROM %s"%(select, table)
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
150 if wheres:
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
151 query += " WHERE " + (" " + whereOp + " ").join(wheres)
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
152
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
153 if order:
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
154 query += " ORDER BY " + order
7
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
155
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
156 if limit:
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
157 query += " LIMIT " + limit
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
158
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
159 if offset:
917e28a08c58 search case insensitive. max and skip options.
casties
parents: 5
diff changeset
160 query += " OFFSET " + offset
4
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
161
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
162 return {'query' : query, 'args' : args}
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
163
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
164 def ZDBInlineSearch(self, _table=None, **argv):
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
165 """returns result set from search"""
5
ca30cf0e810d fix bugs in ZDBInlineSearch.
root@xserve09.mpiwg-berlin.mpg.de
parents: 4
diff changeset
166 query = self.getSQLQuery(_table, argv)
4
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
167 result = self.executeZSQL(query['query'], query['args'])
0ade331198de first version of ZDBInlineSearch
casties
parents: 3
diff changeset
168 return result
3
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
169
9
87087f4f4059 fixed bug with default sort order.
root@xserve09.mpiwg-berlin.mpg.de
parents: 8
diff changeset
170 def manage_editZDBInterfaceFolder(self, title=None, connection_id=None, autocommit=None, default_search=None,
3
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
171 REQUEST=None):
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
172 """Change the object"""
9
87087f4f4059 fixed bug with default sort order.
root@xserve09.mpiwg-berlin.mpg.de
parents: 8
diff changeset
173 logging.debug("editZDBInterfaceFolder title=%s, connection_id=%s, autocommit=%s default_search=%s"%(title,connection_id,autocommit,default_search))
3
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
174 if title is not None:
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
175 self.title = title
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
176
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
177 if connection_id is not None:
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
178 self.connection_id = connection_id
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
179
9
87087f4f4059 fixed bug with default sort order.
root@xserve09.mpiwg-berlin.mpg.de
parents: 8
diff changeset
180 if default_search is not None:
87087f4f4059 fixed bug with default sort order.
root@xserve09.mpiwg-berlin.mpg.de
parents: 8
diff changeset
181 self.default_search = default_search
87087f4f4059 fixed bug with default sort order.
root@xserve09.mpiwg-berlin.mpg.de
parents: 8
diff changeset
182
8
17b19345d011 added autocommit option.
casties
parents: 7
diff changeset
183 self.autocommit = (autocommit == "on")
17b19345d011 added autocommit option.
casties
parents: 7
diff changeset
184
3
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
185 #checkPermission=getSecurityManager().checkPermission
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
186 REQUEST.RESPONSE.redirect('manage_main')
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
187
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
188
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
189 manage_addZDBInterfaceFolderForm=PageTemplateFile('zpt/addZDBInterfaceFolder',globals())
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
190
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
191 def manage_addZDBInterfaceFolder(self, id, title='', label='', description='',
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
192 createPublic=0,
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
193 createUserF=0,
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
194 REQUEST=None):
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
195 """Add a new object with id *id*."""
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
196
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
197 ob=ZDBInterfaceFolder(str(id),title)
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
198 self._setObject(id, ob)
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
199
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
200 #checkPermission=getSecurityManager().checkPermission
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
201 REQUEST.RESPONSE.redirect('manage_main')
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
202
d70e57193731 new executeZSQL method that returns Zope Results.
casties
parents:
diff changeset
203