I use MySQL and after upgrading to 2.0.x I see MySQL warnings from time to
time printed to stdout. It appears they originate from MySQLdb.
Here is a simple example of how to produce the warnings.
db.executesql('DROP TABLE IF EXISTS non_existent_table')
/path/to/2.0.8/web2py/gluon/dal.py:1653: Warning: Unknown table
'non_existent_table'
ret = self.cursor.execute(*a, **b)
Here is how I solved it. In *gluon/dal.py* add:
import warnings
class MySQLAdapter(BaseAdapter):
def execute(self, *a, **b):
if 'MySQL(MySQLdb)' in DRIVERS:
with warnings.catch_warnings(record=True) as warning_messages:
result = self.log_execute(*a, **b)
for w in warning_messages:
logger.warning(w)
else:
result = self.log_execute(*a, **b)
return result
Could that be considered for the trunk?
--