yes you can:
def index():
try:
db.mytable.insert(myfield='myvalue')
db.commit()
except: db.rollback()
try:
db.mytable.insert(myfield='myothervalue')
db.commit()
except:
rollback()
return dict()
On Nov 8, 5:31 am, Jiff <[EMAIL PROTECTED]> wrote:
> On 8 nov, 07:25, mdipierro <[EMAIL PROTECTED]> wrote:
> ....
>
> > For example you can have a controller like
>
> > def index():
> > db.mytable.insert(myfield='myvalue')
> > db.commit()
> > db.mytable.insert(myfield='myothervalue')
> > db.commit()
> > return dict()
>
> Yeah, that's what I thought: my PB is still here: if there's a failure
> between two commits,
> I can't rollback the whole transaction block but only a small part of
> it.
> (but may be I'm wrong; this is my beginning wuth Python and a
> Framework, so my
> understanding isn't very deep at this time...)
>
> > This should work fine. Let me know if it does not and which database
> > you use.
>
> I use PostgreSQL (Ver. 8.1 & 8.3)
>
> JY
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---