ensure we rollback incase of any exception since we are using transaction.commit_manually, ensures we do not encounter "Transaction managed block ended with pending COMMIT/ROLLBACK"
pep8 cleanup
Delete instances in mongodb directly via a query, ensures that
deletions are faster and hence resolves #993
Merge branch 'master' into 993_faster_xform_delete

* master:
  update test to use instance id on delete
  display only photo attachments on photo view
  ensure mimetype is set on saving an attachment
  pep8
  FIxed tesst to use id param for delete_data url instead of mongo api style queries
  Updated delete data to use the instance id instead of the uuid which can be ducplicated - fixes #927
Merge pull request #1031 from modilabs/993_faster_xform_delete

#993 faster xform delete