Hello,
with the object of adding some exception case handling finery to my
little TG project, I would like to know what is a good (and if
possible general) way to check if the database back-end is alive.
Currently I am doing it with something like (assuming I have an
SQLObject called Session)
try:
i=Session.select().count()
except:
return dict(
databaseUp=False,
errorText=str(sys.exc_info()[1])
)
else:
return dict(
databaseUp=True,
#real data sent to template
but it is ugly and based on the specific information that I have a
table called Session. Also, I am checking the availability of a
service through the existence of an object that is related to that
service... very ugly even in principle.
I guess that there should be a function to do this check either in
SQLObject or in psycopg2, but I cannot find it.
thank you
W.
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---