version 1.1.1.1, 2003/11/28 15:03:10
|
version 1.2, 2003/12/03 17:38:43
|
Line 7 import re
|
Line 7 import re
|
import string |
import string |
from AccessControl import getSecurityManager |
from AccessControl import getSecurityManager |
|
|
|
def quoteString(name): |
|
#return re.sub(r'([\(\)\?])',"\\\1",name) |
|
#return "Euklid" |
|
return name |
|
|
class ZSQLExtendFolder(Persistent, Implicit, Folder): |
class ZSQLExtendFolder(Persistent, Implicit, Folder): |
"""Folder""" |
"""Folder""" |
meta_type="ZSQLExtendFolder" |
meta_type="ZSQLExtendFolder" |
Line 16 class ZSQLExtendFolder(Persistent, Impli
|
Line 21 class ZSQLExtendFolder(Persistent, Impli
|
qs=[] |
qs=[] |
|
|
|
|
|
|
|
|
for a in argv.keys(): |
for a in argv.keys(): |
qs.append(a+"="+urllib.quote(str(argv[a]))) |
qs.append(a+"="+urllib.quote(str(argv[a]))) |
|
|
Line 102 class ZSQLExtendFolder(Persistent, Impli
|
Line 109 class ZSQLExtendFolder(Persistent, Impli
|
whereList=[] |
whereList=[] |
sort="" |
sort="" |
op="bw" |
op="bw" |
|
opfields={} |
|
|
if not select: |
if not select: |
select="*" |
select="*" |
|
|
|
#check for op in the case of inline search |
|
if iCT=="_": |
|
for q in qs.split(","): |
|
name=re.sub("r'+'"," ",q.split("=")[0].lower()) |
|
value=urllib.unquote(q.split("=")[1]) |
|
|
|
if name[0:3]==iCT+"op": |
|
op=value |
|
field=name[4:] |
|
opfields[field]=op |
|
|
|
#now analyse the querystring |
for q in qs.split(","): |
for q in qs.split(","): |
try: |
try: |
|
|
name=re.sub("r'+'"," ",q.split("=")[0].lower()) |
name=re.sub("r'+'"," ",q.split("=")[0].lower()) |
value=urllib.unquote(q.split("=")[1]) |
value=urllib.unquote(q.split("=")[1]) |
|
value=quoteString(value) |
if name==iCT+"lop": |
if name==iCT+"lop": |
lop=value |
lop=value |
elif name==iCT+"table": |
elif name==iCT+"table": |
Line 131 class ZSQLExtendFolder(Persistent, Impli
|
Line 151 class ZSQLExtendFolder(Persistent, Impli
|
elif name==iCT+"op": |
elif name==iCT+"op": |
op=value |
op=value |
|
|
|
|
|
|
elif (not name[0]==iCT) and (not len(value)==0): |
elif (not name[0]==iCT) and (not len(value)==0): |
|
if opfields.has_key(name): |
|
op=opfields[name] |
if op=="ct": |
if op=="ct": |
whereList.append(name+"~\'.*"+value+".*\'") |
whereList.append(name+"~\'.*"+value+".*\'") |
elif op=="gt": |
elif op=="gt": |
Line 155 class ZSQLExtendFolder(Persistent, Impli
|
Line 179 class ZSQLExtendFolder(Persistent, Impli
|
|
|
query="SELECT %s FROM %s %s %s"%(select,table,where,sort) |
query="SELECT %s FROM %s %s %s"%(select,table,where,sort) |
|
|
|
self.REQUEST.SESSION['qs']=opfields |
return self.search(var=query) |
return self.search(var=query) |
|
|
def ZSQLSearch(self): |
def ZSQLSearch(self): |