PyGotham/pygotham — pull request #56 by dirn (2014-07-25 19:31:33+00:00)
Title: Use session set by the sponsor application form

When populating the sponsor instance with `form.populate_obj`, the
instance becomes associated with a session. Because of this, calling
`db.session.add` results in `sqlalchemy.exc.InvalidRequestError` because
the sponsor level instance is already attached to a session.

Rather than trying to add the sponsor instance to another session and
committing it, `commit` needs to be called from the instance's session.

Fixes #52