# -*- coding: utf-8 -*-
import MySQLdb
from MySQLdb.cursors import DictCursor
def catch_2006(func):
"""
To catch MySQL Error 2006 ('Server has gone away')
"""
def _(self, *args, **kwargs):
try:
return func(self, *args, **kwargs)
except MySQLdb.Error, e:
print __file__, e
...