New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Related items data converter fix with tests: supports explicit value_… #47
Conversation
…type specified in field when using collections of UUID values. This is backward-compatible with previous conversion to field values.
return collectionType(v for v in value) | ||
valueType = getattr(self.field.value_type, '_type', unicode) | ||
if isinstance(valueType, tuple): | ||
valueType = self.field.value_type[-1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should the value_type be a instance of tuple?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was never necessary.
+1 for this. But before merging, I just want to know about the usecase - which datatype are you converting your uuid values to? the tests do not reflect that (maybe you can update them accordingly...). plus: you might be interested in my refactoring of the related items widget (nearly finished. i just can't effort the time to fix the probably numerous CMFPlone robot tests failures before submitting it as final PR.) |
@thet use case:
The test now loops through three field scenarios reflects collection provided with:
All my add-ons store list of str elements (declared as List of BytesLine) for content references; keeping it that way avoids migration. IIRC, there are other add-on authors who have done this, but I do not have specific example. FWIW, I'm also working on backporting this into same converter in plone.app.widgets 1.x branch. |
Bump... anyone want to merge this? The only thing Jenkins check was choking on was a false positive on a robot test unrelated to this commit (and said test runs fine locally, so this is likely selenium bug), see: https://community.plone.org/t/robot-test-failing-on-pr-issue-seems-indeterminate/2384 Cc: @thet |
Keep hitting more weird robot failures that are ONLY happening on Jenkins server, not in local testing. I don't see these failures in any way related to my change. @jensens @thet any advice? I'm going to retry the Jenkins build again, assuming this is just some strange intermittent Jenkins problem, not actually a test problem. This works locally (while running bin/robot-server against appropriate profile, selenium uses Firefox 46):
|
I have no idea whats going on there. My opinion is to mark these tests as unstable. @tisto is against it and iirc said that fixing and debugging robot tests is the same as unittests, so this should be able to fix. But I failed at it, because I can get the error to pop up on my local machine and alo I have no access to jenkins on admin level inin order to try to debug there. |
Well, retrying seemed to do the trick. I think this is ready to merge. |
sorry for not coming back earlier to this one. Missed the notification emails. I'm going to merge this one. |
…type specified in field when using collections of UUID values. This is backward-compatible with previous conversion to field values.
Add-ons using collection of BytesLine values for UUIDs break without this fix, when using the mockup related items widget (which has strings submitted in JSON marshalled to unicode without regard to actual/declared field value type). This PR addresses that, and is backward compatible with existing default behavior (allowing use of TextLine/unicode or BytesLine/str to store UUID values).