Closed (fixed)
Project:
Feeds
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
23 Jan 2016 at 16:44 UTC
Updated:
4 Aug 2016 at 14:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
louis delacretaz commentedworks well for me
Comment #3
megachrizSetting to "needs review" so the testbot will evaluate the patch.
Comment #5
alan-ps commentedre-roll
Comment #6
megachrizI tried the patch and importing a timezone value worked when providing a valid timezone value.
system_time_zones()and throw a FeedsValidationException if the value is invalid.Comment #7
alan-ps commentedProbably, we should just skip an import of the timezone (set to NULL) if value is incorrect. What do you think?
In any case, I have added necessary changes from the comment above for reviewing. Any remarks are welcome :)
Comment #8
megachrizThanks for your work, alan-ps!
I personally think that the item should be rejected, so the user is notified that the source contains a problem. In any case, emptying the current value in case of an invalid value doesn't sound right to me. Emptying should only be done if the provided value is empty. To test that behaviour, for one user there should be a timezone set before doing the import and for that same user there should be no timezone specified in the source file. After importing, the timezone should be empty.
There has been some discussion in #2379631: field_attach_validate() must be called before programmatic entity saves about whether or not an item should be "corrected" or rejected. My conclusion was that Feeds has no way of knowing if a value that is invalid is important or not. So it cannot decide if it is okay to just skip that value or if it should halt the whole item for it so the user can correct the source.
According to #2379631-11: field_attach_validate() must be called before programmatic entity saves there are three options:
Comment #9
alan-ps commentedYes, you convinced me! I have attached new patch with necessary changes.
Comment #10
megachrizThis looks great!
To make the tests complete, you could add the following:
As for the error message, maybe it should also display which value is invalid? It doesn't do for name and mail of the user though, but I think it could be helpful.
Comment #11
alan-ps commentedThe patch was updated. I guess it will be final variant:)
Comment #12
megachrizThis looks good! I need some time yet to test it in action and if I found no issues I will commit it!
Comment #14
megachrizCommitted #11. Thanks!