I fixed this with this hack, which tries to reestablish a connection
_once_ on error. This seems to take care of most transient 'server has
gone away' mysql server errors like timed-out connections, restarted
mysql server, etc.

Is there a better way of doing this? If not could I suggest that this
kind of functionality is included in TG? It seems like this _should_ be
a common problem.

I use mysql 5, TG 0.9a4 fwiw.

Changed the PackageManager code in database.py as follows:

    def __get__(self, obj, type):
        import _mysql_exceptions
        if not self.hub:
            self.set_hub()
        try:
                data = self.hub.__get__(obj, type)
        except _mysql_exceptions.OperationalError:
                #reconnect and try again once
                self.set_hub()
                data = self.hub.__get__(obj, type)
        return data


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to