-
Notifications
You must be signed in to change notification settings - Fork 60
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
retrieve method fails if only one record found #32
Comments
Perhaps I'm missing understanding. but seems like demo.py should just make sure that __theIds has at least 2 records in it, then everything will behave as expected. Ideally the behavior of retrieve should return an array if the id list was an array, but i think its too late to change that unless we add retrieve2 or something. Yes, adding retrieve to IterClient is a good idea. |
There is one Account created, updated, deleted, undeleted by demo and finally there is exactly by one Account more that at the beginning. In order to pass the script there must be finally at least two records with the name "New Account" that is not usual even in a live SF database. Yes, I was surprised that it failed always only for the first time in a new sandbox and I was anxious if I hadn't made a bug.. |
I fixed also the demo that it can continue on a plain sandbox without custom fields. Only a warning is reported. |
I'm thinking about a forward compatibility switch, that would be in a backward compatibility position by default. Another example: if the result has an element |
I use
demo.py
for tests. Your original current source fails on an empty Salesforce instance or if no Account "New Account" has been present before running the demo.It is because
beatbox.Client.retrive
returns directly onexmltramp.Element
instead of a list of length 1.The backward compatible solution is to modify only the demo.py so that it is tested if the result is a list or an Element :
... but this is not a demo of advisable clean code.
A more natural solution would be to return a list of elements by
beatbox.Client.retrieve
if theids
parameter is a list, otherwise to return an element if an Id is used directly without list.The best solution is probably to add a
retrive
method to IterClient class and also to write an example with IterClient to the documentation because that class is very useful. It will be both natural and backward compatible. What do you mean?The text was updated successfully, but these errors were encountered: