I have written a series of zope pages for a person to update their
record in our mysql database.   They use a zpt->python->db sql->db
driver->db flow and work pretty well.

Unfortunately, if enough people use it, the number of open db
connections grows until it hits a limit and the db stops accepting
connections.  I have seen that there is a connection issue with zope
and mysql, but have not been able to find a solution.  Is there one?

Also, I put in some exception handling to trap any db errors and email
the post if there are any.  However, i am not sure it is working.  I
performed a test to the db update from my page with the db off and got
a Database Error that wasn't caught by my exception handler.  I am not
sure why since I thought Exception would be the root of Database
Errors.  My code looks like this:

  result = context.updatePerson(**query_args)
  return text
except Exception:
    mto = "<to address>"
    mfrom = "<from address>"
    subject = "Updated supporter information"
    body = printed
    context.MailHost.simple_send(mto, mfrom, subject, body)
    print result
    return text
  except Exception:
    errorText = '<h1>Ooooppps!</h1><p>There was an error submitting
your information to our database and our backup logging method. 
Please email the <a href="mailto:webmaster@<domain>">webmaster</a>
that you got an error so that we can track it down and fix
    print errorText
    return printed
    return errorText

The traceback error is:

Exception Type          Database Error
Exception Value         updatePerson is not connected to a database

Any insights would be most welcome.


Zope-DB mailing list

Reply via email to