

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
37 messages in net.sourceforge.lists.plone-developersRe: CMFFormController should abort th...| From | Sent On | Attachments |
|---|---|---|
| Dorneles Treméa | Nov 9, 2007 3:17 pm | |
| Philipp von Weitershausen | Nov 10, 2007 7:07 am | |
| Dorneles Treméa | Nov 10, 2007 7:58 am | |
| Wichert Akkerman | Nov 10, 2007 12:22 pm | |
| Martin Aspeli | Nov 10, 2007 2:12 pm | |
| Wichert Akkerman | Nov 10, 2007 4:20 pm | |
| Philipp von Weitershausen | Nov 11, 2007 1:32 am | |
| Dorneles Treméa | Nov 11, 2007 5:19 pm | |
| Alan Runyan | Nov 11, 2007 5:20 pm | |
| Martin Aspeli | Nov 11, 2007 5:44 pm | |
| Martin Aspeli | Nov 11, 2007 5:51 pm | |
| Wichert Akkerman | Nov 12, 2007 4:37 am | |
| Sidnei da Silva | Nov 12, 2007 4:43 am | |
| Daniel Kraft | Nov 12, 2007 5:40 am | |
| Martin Aspeli | Nov 12, 2007 5:52 am | |
| Dorneles Treméa | Nov 12, 2007 9:35 am | |
| Wichert Akkerman | Nov 12, 2007 9:56 am | |
| Martin Aspeli | Nov 12, 2007 9:59 am | |
| Martin Aspeli | Nov 12, 2007 10:00 am | |
| Dorneles Treméa | Nov 12, 2007 10:56 am | |
| Martin Aspeli | Nov 12, 2007 11:14 am | |
| Martin Aspeli | Nov 12, 2007 11:21 am | |
| Wichert Akkerman | Nov 12, 2007 11:36 am | |
| Martin Aspeli | Nov 12, 2007 11:41 am | |
| Sidnei da Silva | Nov 12, 2007 11:47 am | |
| Martin Aspeli | Nov 12, 2007 12:04 pm | |
| Dorneles Treméa | Nov 12, 2007 12:28 pm | |
| Dorneles Treméa | Nov 12, 2007 12:34 pm | |
| Dorneles Treméa | Nov 12, 2007 1:29 pm | |
| Wichert Akkerman | Nov 12, 2007 1:32 pm | |
| Martin Aspeli | Nov 12, 2007 1:41 pm | |
| Dorneles Treméa | Nov 12, 2007 1:44 pm | |
| Martin Aspeli | Nov 12, 2007 1:46 pm | |
| Wichert Akkerman | Nov 12, 2007 1:46 pm | |
| Martin Aspeli | Nov 12, 2007 1:47 pm | |
| Dorneles Treméa | Nov 12, 2007 5:11 pm | |
| Daniel Nouri | Nov 13, 2007 4:14 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread 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 fails | Actions... |
|---|---|---|
| From: | Martin Aspeli (opti...@public.gmane.org) | |
| Date: | Nov 12, 2007 9:59:35 am | |
| List: | net.sourceforge.lists.plone-developers | |
Dorneles Treméa-2 wrote:
You asked for a way to 'save something even if validation fails'. I presented that to you.
A premature commit is bad, but at least you have the choice to do it, and this choice is something that we don't have now for the 'abort' case.
Sure you do. Just don't do any writing prior to the validator or on the "failure" path after the validator.
Or, let the failure path of the validator call abort() explicitly.
Of course I can do whatever I want in a custom content-type and/or plain form validation... but I'm talking about the *standard* behavior of the Archetypes/CMFFormController integration... and even further, the standard behavior of CMFFormController validation.
We need to keep Archeytpes and CMFFormController separate. If Archetypes causing writes prior to the validator succeeding, then that's insane, and Archetypes must be fixed. That doesn't mean we should doom any and all transactions whenever any validator in any form controller chain dies, though.
As Wichert and Sidnei pointed out, the default use case should be:
- abort any persistent change, and give the option to save something even if the validation fails
But the current default implementation can be read as:
- keep the persistent changes, and doesn't allow us to abort them if the validation fails... :-/
I don't think we don't have a choice - see above.
In other words: make the more sensical case be the default one, while still allowing the exception case possible.
Do you see my point?
I see your point from an Archetypes perspective. I don't think CMFFormController is the right place to put this, though - Archetypes is. Form page flow should be separate from transaction management, imho. I wouldn't expect a form page flow framework to irretrievably doom my transactions ever. That should be an explicit choice.
And as I said, in any sane formlib chain, this isn't an issue. You don't save (unless you wanted to!) before the validator has had a chance to validate.
In fact, it's much easier to fix it directly on Archetypes, but what I want to make sure people understand is that the current implementation assumes the wrong case as the default one.
Rolling back everything if validation fails is what the vast majority wants per default.
I'm not sure I agree. And even if it's the most common use case. That is, I think in the vast majority of cases, this is a non-issue. Having an abort hardcoded in there would make it very hard to have cases where you wanted to save after a validator failure.
In fact, the way form controller work, we have the conventions "success" and "failure" as exit paths from a validator. However, IIRC you can use anything. "partial-success" maybe. In any case, it's a matter of flow design where you put your writes.
Of course, that chain is not sane. There should be a pre-write validator that checks the whole Archetype, and only then should something be saved. In fact, I thought that's how it worked for other fields. Perhaps it's a deficiency in this particular widget's implementation?
Perhaps, but this should not block us from doing the Right Thing™!
I don't think it's the Right Thing, or at least, it's not the Right Place. :)
In fact, I would say that Archetypes misses a 'Validation Failed' event... but that's story for another mail... :-)
Archetypes 1.5 has subscription-adapter based validation.
I agree with you that this expectation is not valid 100% of the time, but I'm sure you agree with me that it should be the default one.
Being the default one, and allowing the case where you can save things even if validation fails should covers 100% of the cases... ;-)
Not necessarily. A premature commit is bad, because if something later failed (a ConflictError, say) then you may end up with inconsistent state. If that's your only choice, then you're sacrificing integrity.
If you think about it, we use transaction.abort() very rarely in Zope and Plone. It's pretty drastic. Doing it in a form page flow framework feels completely wrong.
Think of it differently - you don't get a transaction abort if a formlib validator or zope.interface invariant fails. That'd be crazy too. ;)
Do you still think that way now? :-)
Yes. I'm still -1 on this change. (but +1 on fixing in Archetypes, or that widget, obviously). Aborting a transaction is a blunt and clunky instrument for fixing what should be an obvious programming error, and may stop people from doing legitimate things.
CMFFormController is the wrong place to take decisions about data integrity, and it's so easy to control this explicitly (don't write before validator/don't write on failure path) that I think anyone who does it (apart from Archetypes, apparently, which is buggy in this regard) probably meant to (in which case forcing them prematurely commit to pre-empt an abort - wtf?).
Martin
--
View this message in context:
http://www.nabble.com/CMFFormController-should-abort-the-current-transaction-when-the-validation-fails-tf4780633s6745.html#a13710600
Sent from the Core Developers mailing list archive at Nabble.com.
------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________ Plone-developers mailing list Plon...@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plone-developers







