I did actually Google prior to posting and was unable to find much
other than a bunch of forum postings with incomplete arguments about
cases quite different from this one.  Perhaps you found more. I would
be curious to see a well though out statement on this issue.

Regardless of the flow control debate, personally I consider the
attempted saving of invalid data an exception, just as much as a file-
not-found, end-of-file, or a database constraint violation (to which
model validation is essentially equivalent).  Invalid data is not a
expected state, except perhaps arguably where dumb user input is
involved.  However DataMapper is an ORM, not a web framework, so it
should not be designed primarily for user input.

My more immediately point is that it is hard, if not impossible, to
write correct code currently with DM.  Can you suggest a pattern for
handling validation that is correct?

Let's take a simpler case of importing data from a file:

http://pastie.org/325959

The basic problem is that there is no guarantee of what "false" means
when returned from save.  If you change the contract to be that false
means there was a validation error, and state exceptions are thrown in
any other instance of save failure, then I could write correct code.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" 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/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to