--- ZSQLExtend/ZSQLExtend.py 2004/10/19 11:24:12 1.41 +++ ZSQLExtend/ZSQLExtend.py 2004/10/21 15:36:53 1.42 @@ -13,6 +13,21 @@ from Products.PageTemplates.PageTemplate from Products.ZSQLMethods.SQL import SQLConnectionIDs import Shared.DC.ZRDB.DA +def analyseIntSearch(word): + #analyse integer searches + + splitted=word.split("-") + print splitted + if splitted[0]=="": + return "< "+splitted[1] + + if splitted[1]=='': + return "> "+splitted[0] + else: + return "BETWEEN "+splitted[0]+" AND "+splitted[1] + + + def sql_quote(v): # quote dictionary quote_dict = {"\'": "''", "\\": "\\\\"} @@ -660,7 +675,17 @@ class ZSQLExtendFolder(Folder,Persistent tmps.append(name+" LIKE "+sql_quote("%"+word+"%")) tmp=string.join(tmps,' AND ') - + + elif op=="numerical": + term=analyseIntSearch(value) + tmp=(name+" "+term) + elif op=="one": + tmps=[] + for word in value.split(" "): + tmps.append(name+" LIKE "+sql_quote("%"+word+"%")) + + tmp=string.join(tmps,' OR ') + op="ct" if (not tableExt) or (namealt.split('.')[0]==tableExt): @@ -786,6 +811,7 @@ class ZSQLExtendFolder(Folder,Persistent def nextLink(self,html,storename="foundCount"): """nextLink""" + print self.REQUEST.SESSION[storename]['rangeSize'] try: limit=self.REQUEST.SESSION[storename]['rangeSize'] if int(limit)==0 : @@ -838,6 +864,7 @@ class ZSQLExtendFolder(Folder,Persistent def prevLink(self,html,storename="foundCount"): """prev link""" + try: limit=self.REQUEST.SESSION[storename]['rangeSize'] if int(limit)==0 :