Thanks to visit codestin.com
Credit goes to github.com

Skip to content

A commit_on_success decorator #4

@yashh

Description

@yashh

Since most of the projects using sqlalchemy uses mysql / postgres there is a good chance of using transactions. Having a commit_on_success decorator can save a try except block in the view functions. Here is a rough draft of the decorator I wrote.

https://gist.github.com/14d12595f3dfa307a354

Just wondering if its a good idea to get the db object from the function object. (line # 11)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions