瀏覽代碼

Fixes for MySQL-python==1.2.5

version-14
Anand Doshi 11 年之前
父節點
當前提交
0e4dce8ec2
共有 2 個檔案被更改,包括 7 行新增2 行删除
  1. +5
    -0
      webnotes/db.py
  2. +2
    -2
      webnotes/widgets/form/utils.py

+ 5
- 0
webnotes/db.py 查看文件

@@ -80,6 +80,11 @@ class Database:
if values!=():
if isinstance(values, dict):
values = dict(values)
# MySQL-python==1.2.5 hack!
if not isinstance(values, (dict, tuple, list)):
values = (values,)
if debug:
try:
self.explain_query(query, values)


+ 2
- 2
webnotes/widgets/form/utils.py 查看文件

@@ -42,13 +42,13 @@ def validate_link():
webnotes.response['message'] = 'Ok'
return
if webnotes.conn.sql("select name from `tab%s` where name=%s" % (options, '%s'), value):
if webnotes.conn.sql("select name from `tab%s` where name=%s" % (options, '%s'), (value,)):
# get fetch values
if fetch:
webnotes.response['fetch_values'] = [webnotes.utils.parse_val(c) \
for c in webnotes.conn.sql("select %s from `tab%s` where name=%s" \
% (fetch, options, '%s'), value)[0]]
% (fetch, options, '%s'), (value,))[0]]
webnotes.response['message'] = 'Ok'



Loading…
取消
儲存