fixed some issues in dal.py and sqlhtml.py thanks Michele
This commit is contained in:
2
VERSION
2
VERSION
@@ -1 +1 @@
|
||||
Version 1.99.4 (2012-01-31 08:48:24) stable
|
||||
Version 1.99.4 (2012-02-01 11:35:57) stable
|
||||
|
||||
@@ -1930,7 +1930,7 @@ class PostgreSQLAdapter(BaseAdapter):
|
||||
def __init__(self,db,uri,pool_size=0,folder=None,db_codec ='UTF-8',
|
||||
credential_decoder=lambda x:x, driver_args={},
|
||||
adapter_args={}):
|
||||
if not self.drivers.get('psycopg2') and not self.drivers.get('psycopg2'):
|
||||
if not self.drivers.get('psycopg2') and not self.drivers.get('pg8000'):
|
||||
raise RuntimeError, "Unable to import any drivers (psycopg2 or pg8000)"
|
||||
self.db = db
|
||||
self.dbengine = "postgres"
|
||||
|
||||
@@ -1297,6 +1297,9 @@ class SQLFORM(FORM):
|
||||
|
||||
@staticmethod
|
||||
def build_query(fields,keywords):
|
||||
if isinstance(keywords,(tuple,list)):
|
||||
keywords = keywords[0]
|
||||
request.vars.keywords = keywords
|
||||
key = keywords.strip()
|
||||
if key and not ' ' in key and not '"' in key and not "'" in key:
|
||||
SEARCHABLE_TYPES = ('string','text','list:string')
|
||||
@@ -1647,12 +1650,13 @@ class SQLFORM(FORM):
|
||||
console.append(form)
|
||||
keywords = request.vars.get('keywords','')
|
||||
try:
|
||||
subquery = SQLFORM.build_query(sfields, keywords)
|
||||
if callable(searchable):
|
||||
subquery = searchable(sfields, keywords)
|
||||
else:
|
||||
subquery = SQLFORM.build_query(sfields, keywords)
|
||||
except RuntimeError:
|
||||
subquery = None
|
||||
error = T('Invalid query')
|
||||
elif callable(searchable):
|
||||
subquery = searchable(keywords,fields)
|
||||
else:
|
||||
subquery = None
|
||||
if subquery:
|
||||
|
||||
Reference in New Issue
Block a user