Merge github.com:web2py/web2py
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.1.0 (2012-10-12 12:18:47) dev
|
Version 2.1.0 (2012-10-12 22:16:19) dev
|
||||||
|
|||||||
@@ -6565,6 +6565,10 @@ def smart_query(fields,text):
|
|||||||
elif op == 'startswith': new_query = field.startswith(value)
|
elif op == 'startswith': new_query = field.startswith(value)
|
||||||
elif op == 'endswith': new_query = field.endswith(value)
|
elif op == 'endswith': new_query = field.endswith(value)
|
||||||
else: raise RuntimeError, "Invalid operation"
|
else: raise RuntimeError, "Invalid operation"
|
||||||
|
elif field._db._adapter.dbengine=='google:datastore' and \
|
||||||
|
field.type in ('list:integer', 'list:string', 'list:reference'):
|
||||||
|
if op == 'contains': new_query = field.contains(value)
|
||||||
|
else: raise RuntimeError, "Invalid operation"
|
||||||
else: raise RuntimeError, "Invalid operation"
|
else: raise RuntimeError, "Invalid operation"
|
||||||
if neg: new_query = ~new_query
|
if neg: new_query = ~new_query
|
||||||
if query is None:
|
if query is None:
|
||||||
|
|||||||
+6
-1
@@ -1528,15 +1528,20 @@ class SQLFORM(FORM):
|
|||||||
'datetime':['=','!=','<','>','<=','>='],
|
'datetime':['=','!=','<','>','<=','>='],
|
||||||
'integer':['=','!=','<','>','<=','>='],
|
'integer':['=','!=','<','>','<=','>='],
|
||||||
'double':['=','!=','<','>','<=','>='],
|
'double':['=','!=','<','>','<=','>='],
|
||||||
|
'id':['=','!=','<','>','<=','>='],
|
||||||
|
'reference':['=','!=','<','>','<=','>='],
|
||||||
'boolean':['=','!=']}
|
'boolean':['=','!=']}
|
||||||
if fields[0]._db._adapter.dbengine=='google:datastore':
|
if fields[0]._db._adapter.dbengine=='google:datastore':
|
||||||
search_options['string'] = ['=','!=','<','>','<=','>=']
|
search_options['string'] = ['=','!=','<','>','<=','>=']
|
||||||
search_options['text'] = ['=','!=','<','>','<=','>=']
|
search_options['text'] = ['=','!=','<','>','<=','>=']
|
||||||
|
search_options['list:string'] = ['contains']
|
||||||
|
search_options['list:integer'] = ['contains']
|
||||||
|
search_options['list:reference'] = ['contains']
|
||||||
criteria = []
|
criteria = []
|
||||||
selectfields = []
|
selectfields = []
|
||||||
for field in fields:
|
for field in fields:
|
||||||
name = str(field).replace('.','-')
|
name = str(field).replace('.','-')
|
||||||
options = search_options.get(field.type,None)
|
options = search_options.get(field.type.split(' ')[0],None)
|
||||||
if options:
|
if options:
|
||||||
label = isinstance(field.label,str) and T(field.label) or field.label
|
label = isinstance(field.label,str) and T(field.label) or field.label
|
||||||
selectfields.append(OPTION(label, _value=str(field)))
|
selectfields.append(OPTION(label, _value=str(field)))
|
||||||
|
|||||||
@@ -190,6 +190,8 @@ def is_valid_ip_address(address):
|
|||||||
elif address.lower() in ('unkown',''):
|
elif address.lower() in ('unkown',''):
|
||||||
return False
|
return False
|
||||||
elif address.count('.')==3: # assume IPv4
|
elif address.count('.')==3: # assume IPv4
|
||||||
|
if address.startswith('::ffff:'):
|
||||||
|
address = address[7:]
|
||||||
if hasattr(socket,'inet_aton'): # try validate using the OS
|
if hasattr(socket,'inet_aton'): # try validate using the OS
|
||||||
try:
|
try:
|
||||||
addr = socket.inet_aton(address)
|
addr = socket.inet_aton(address)
|
||||||
|
|||||||
Reference in New Issue
Block a user