This may or may not be specific to SQLAlchemy (rather than elixir),
but I figured I'd ask seeing as how this list is much more active. I'm
experiencing only a partial rollback in the following code --
invite_code gets incremented even when the exception is caught and
session rolled back. When I switch the two lines after begin(), this
goes away. I'm using autocommit=True, sqlalchemy 0.6.4.

---------------------------------------------------
invite_code =
InviteCode.query.filter_by(code=code).first()

elixir.session.begin()
user = User(...)
invite_code.used = invite_code.used +
1

try:
 
elixir.session.commit()
except
IntegrityError:
  # Thrown on duplicate email
address
 
elixir.session.rollback()
 
return
---------------------------------------------------

Cheers!

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to