Updated from latest web2py master

This commit is contained in:
gi0baro
2014-09-19 17:37:35 +02:00
parent b20b81b8f5
commit 947dcbc226
6 changed files with 46 additions and 20 deletions
+15 -7
View File
@@ -64,7 +64,7 @@ class BaseAdapter(ConnectionPool):
__metaclass__ = AdapterMeta
native_json = False
driver_auto_json = False
driver = None
driver_name = None
drivers = () # list of drivers from which to pick
@@ -1113,13 +1113,20 @@ class BaseAdapter(ConnectionPool):
query = self.common_filter(query,tablenames_for_common_filters)
sql_w = ' WHERE ' + self.expand(query) if query else ''
JOIN = ' CROSS JOIN '
if inner_join and not left:
sql_t = ', '.join([self.table_alias(t) for t in iexcluded + \
itables_to_merge.keys()])
# Wrap table references with parenthesis (approach 1)
# sql_t = ', '.join([self.table_alias(t) for t in iexcluded + \
# itables_to_merge.keys()])
# sql_t = '(%s)' % sql_t
# or approach 2: Use 'JOIN' instead comma:
sql_t = JOIN.join([self.table_alias(t)
for t in iexcluded + itables_to_merge.keys()])
for t in ijoinon:
sql_t += ' %s %s' % (icommand, t)
elif not inner_join and left:
sql_t = ', '.join([self.table_alias(t) for t in excluded + \
sql_t = JOIN.join([self.table_alias(t) for t in excluded + \
tables_to_merge.keys()])
if joint:
sql_t += ' %s %s' % (command,
@@ -1133,7 +1140,7 @@ class BaseAdapter(ConnectionPool):
tables_in_joinon = set(joinont + ijoinont)
tables_not_in_joinon = \
all_tables_in_query.difference(tables_in_joinon)
sql_t = ','.join([self.table_alias(t) for t in tables_not_in_joinon])
sql_t = JOIN.join([self.table_alias(t) for t in tables_not_in_joinon])
for t in ijoinon:
sql_t += ' %s %s' % (icommand, t)
if joint:
@@ -1386,7 +1393,8 @@ class BaseAdapter(ConnectionPool):
else:
obj = str(obj)
elif fieldtype == 'json':
if not self.native_json:
if not 'dumps' in self.driver_auto_json:
# always pass a string JSON string
if have_serializers:
obj = serializers.json(obj)
elif simplejson:
@@ -1524,7 +1532,7 @@ class BaseAdapter(ConnectionPool):
return float(value)
def parse_json(self, value, field_type):
if not self.native_json:
if not 'loads' in self.driver_auto_json:
if not isinstance(value, basestring):
raise RuntimeError('json data not a string')
if isinstance(value, unicode):