

![]() | 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: | Dorneles Treméa (deo-...@public.gmane.org) | |
| Date: | Nov 12, 2007 10:56:45 am | |
| List: | net.sourceforge.lists.plone-developers | |
Hey Wichert,
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
I did not point that out and I do not agree with that point of view.
really? At least that's what I understood when you said:
""" If you asked someone:
During preprocessing of a submitted request you stored some data in the database. What do you expect to happen if the form validation fails?
1. the stored data disappears
2. the stored data is saved
Everyone would pick 1. """
In my opinion a transaction should never be aborted unless a programmer very explicitly says so. A formcontroller path does not fall in that category in my opinion.
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... :-/
It does allow that. If you need to doom the transaction your verification script can do so.
Wichert, it can't! Or if it can, I can't see where... :-/
Follow the path with me:
- You press the 'Save' button in the Archetypes form edit screen
- That form edit screen is a ControllerPageTemplate (base_edit.cpt) with validate_base.vpy as the unique validator
- validate_base.vpy calls BaseObject.validate() to check for errors
- BaseObject.validate() calls BasicSchema.validate() which in turn calls widget.process_form() for all fields
- We have a ReferenceField which uses a special reference widget, UploadReferenceWidget, which was designed to be a simple replacement for the default ReferenceWidget
- That widget receives a FileUpload object via REQUEST, proceeds with a 'File' creation and only returns its UID as the widget value
- Now that there's already a File in ZODB, the validation of another field fails, let's say 'title' was required but nothing was passed
- At this point the validation failed and you're back to the edit form screen with no chance to abort the transaction
Do you see the problem?
The point is: the only place where you can do additional stuff without changing any default Archetypes/CMFFormController settings is in the widget process_form() call, while at validation phase.
I'm still strongly arguing that CMFFormController would be the best place to have this fixed, but I can live with a change on Archetypes.
If you're worried about the 'transaction.abort()' being called by validate_base.vpy, I can suggest to fire a IObjectFailedValidation (or something like that) event there, that can be subscribed by third party code (the special widget, in this case).
--
_______________________________________________________
Dorneles Treméa · Developer, Jarn · www.jarn.com
Plone Solutions, Development, Hosting and Support
_______________________________________________________
Plone Solutions is now known as Jarn www.jarn.com/name-change
------------------------------------------------------------------------- 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/







