37 messages in net.sourceforge.lists.plone-developersRe: CMFFormController should abort th...
FromSent OnAttachments
Dorneles TreméaNov 9, 2007 3:17 pm 
Philipp von WeitershausenNov 10, 2007 7:07 am 
Dorneles TreméaNov 10, 2007 7:58 am 
Wichert AkkermanNov 10, 2007 12:22 pm 
Martin AspeliNov 10, 2007 2:12 pm 
Wichert AkkermanNov 10, 2007 4:20 pm 
Philipp von WeitershausenNov 11, 2007 1:32 am 
Dorneles TreméaNov 11, 2007 5:19 pm 
Alan RunyanNov 11, 2007 5:20 pm 
Martin AspeliNov 11, 2007 5:44 pm 
Martin AspeliNov 11, 2007 5:51 pm 
Wichert AkkermanNov 12, 2007 4:37 am 
Sidnei da SilvaNov 12, 2007 4:43 am 
Daniel KraftNov 12, 2007 5:40 am 
Martin AspeliNov 12, 2007 5:52 am 
Dorneles TreméaNov 12, 2007 9:35 am 
Wichert AkkermanNov 12, 2007 9:56 am 
Martin AspeliNov 12, 2007 9:59 am 
Martin AspeliNov 12, 2007 10:00 am 
Dorneles TreméaNov 12, 2007 10:56 am 
Martin AspeliNov 12, 2007 11:14 am 
Martin AspeliNov 12, 2007 11:21 am 
Wichert AkkermanNov 12, 2007 11:36 am 
Martin AspeliNov 12, 2007 11:41 am 
Sidnei da SilvaNov 12, 2007 11:47 am 
Martin AspeliNov 12, 2007 12:04 pm 
Dorneles TreméaNov 12, 2007 12:28 pm 
Dorneles TreméaNov 12, 2007 12:34 pm 
Dorneles TreméaNov 12, 2007 1:29 pm 
Wichert AkkermanNov 12, 2007 1:32 pm 
Martin AspeliNov 12, 2007 1:41 pm 
Dorneles TreméaNov 12, 2007 1:44 pm 
Martin AspeliNov 12, 2007 1:46 pm 
Wichert AkkermanNov 12, 2007 1:46 pm 
Martin AspeliNov 12, 2007 1:47 pm 
Dorneles TreméaNov 12, 2007 5:11 pm 
Daniel NouriNov 13, 2007 4:14 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: CMFFormController should abort the current transaction when the validation failsActions...
From:Martin Aspeli (opti@public.gmane.org)
Date:Nov 11, 2007 5:44:06 pm
List:net.sourceforge.lists.plone-developers

Alan Runyan wrote:

If form validation fails; the current transaction should be 'doomed'. Because form validation failure != transaction success. I'm +0

I believe if you asked someone: "If you inserted some temporary data into a RDBMS and then further during form processing a validation failed. What do you believe would happen?"

- It would abort and you would not have to worry about anything.

- It would commit the transaction; you would need to handle form validation in your custom validator.

Every request in zope is transactional. So I believe it does make sense for a developer to feel that during form validation; validation failure would result in transaction.abort().

I see why this would be the most common case, but:

CMFFormController is a high(ish) level page flow solution, it feels wrong for it to doom a transaction which may have other things going on. For example, you may want to write a validator and have two exit paths: a "success" page and a "failed" page, but you may still want some stuff written to the database in case of a failure. I don't think this is unreasonable or an unsupported use case in the current implementation.

We can't break that, nor should we. It's very easy to write code that doesn't do the "wrong" thing (that is - you write the "write" in the success path after the validator). If you have a write somewhere else, then either you meant to do that (in which case we shouldn't stomp on your code), or you have a serious, but easily discoverable bug (in which case we shouldn't try to hide that bug from you).

Also - if you wrote some temporary data before the validator and you do want the validator-failed use case to abort, calling transaction.abort/doom yourself is trivial (and explicit). I suspect in 99% of cases, there'd be no temporary data written before the validator. In fact, the validator tends to be the first thing in the chain after the page template in most cases.

Martin