Django Gets Transactions
« Versioning: The Next Big Thing
» Equality for Python
Code: databases, Django, web
Comments Off on Django Gets Transactions
Jacob Kaplan-Moss added transaction support to the magic-removal branch of Django just a few minutes ago. It’s one of the many changes to come out of the sprint. Usage will look something like this (based on Jacob’s docs and chatting with him in #django-sprint):
from django.db import transaction
# you make changes to your objects, calling obj.save() on them as normal
# when you commit, all changes to all objects will be commited to your database
# an excellent idea would be to wrap in a try/except block
# do your stuff
I couldn’t find a good doc quick for Python decorators (that bit with the @ before the function declaration) for people who haven’t used them before, so if someone has a good one, please post it in the comments below.
Here’s a link to the full docs and for those interested in the nitty-gritty, here’s a link to the code checkin.
And before you ask, magic-removal is expected to be merged to trunk before the end of March.