-
Notifications
You must be signed in to change notification settings - Fork 93
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
Using pyodata with old MS CRM 2015 #95
Comments
Hi @bip91, thank you very much for taking the time to report these issues. I think we will very soon come up with an infrastructure for adding handlers for vendor bugs in OData services since We have already have several discrepancies in ByD services. Ad 1. This definitely requires some extension point. Will think about a generic solution. Ad 2. Are you sure it is a bug in MS CRM 2015 and not in pyodata? |
I definitly agree for the first point, this cannot be solve without an extension as it is a very specific implementation of ODATA. In the meantime, I have set a condition to handle this implementation and will see later. For second point, I am not enough skilled in Odata protocol to say what should be the correct behaviour. Perhaps examples below could help. In all cases, pyodata raise a exception on trying to convert to a int a None Value
I do not see any side effect on trapping these 2 exceptions and doing nothing, perhaps it is the right thing to do. **Case 1 and 2 : with 3 samples that raise this exception ** WARNING:pyodata.model:{'__metadata': {'type': 'Microsoft.Crm.Sdk.Data.Services.EntityReference'}, 'Id': None, 'LogicalName': None, 'Name': None} comes from these samples which there is no "Value" tag :
** case 3: is rather the same, but Value is explicitly set to Null **
|
I am afraid that the None/null issue is a bug on pyodata.
https://www.odata.org/documentation/odata-version-2-0/atom-format/ I have to find such a value in Microsoft's Northwind -> https://services.odata.org/V2/Northwind/Northwind.svc/ |
@bip91 Can you re-post the XML responses in JSON here? Just add Example:
The example URLs point the entityset which contains entities having values with null and pyodata can handle them without any problem: PYTHONPATH=./ bin/pyodata https://services.odata.org/V2/Northwind/Northwind.svc/ ENTITY_SET Customers the output is the following:
where the field |
Can you change the lines:
to
and repost your results? |
It is coming from this kind of values :
And content in json format :
|
I came a cross this difference during testing of SAP#95 I decided to set tzinfo of JSON DateTimes to simplify my tests and it also make sense to me to have the values configured the same way.
Only a declared property knows if it accepts Null or not. I was playing with nullable Type but than I would have to have also nullable TypeTraits and there result would be a complete mess. Therefore I decided to move the responsibility to serialize/deserialize the declared property. The decision led to a simpler code which is a good sign. I could have used a better exception type but we currently evaluating the best exception strategies, so I used a generic type. Part of the issue SAP#95
I came a cross this difference during testing of SAP#95 I decided to set tzinfo of JSON DateTimes to simplify my tests and it also make sense to me to have the values configured the same way.
Only a declared property knows if it accepts Null or not. I was playing with nullable Type but than I would have to have also nullable TypeTraits and there result would be a complete mess. Therefore I decided to move the responsibility to serialize/deserialize the declared property. The decision led to a simpler code which is a good sign. I could have used a better exception type but we currently evaluating the best exception strategies, so I used a generic type. Part of the issue SAP#95
Now, I get this error on initializing schema :
So, I have no initialized context to execute the request. Please find joined, metadata url provided by server (with some anonymization, I hope that I have not introduce some error with step) : https://server.com/CRM/XRMServices/2011/OrganizationData.svc/$metadata I hope this could help. |
I cannot reproduce the problem. Didn't you touch this list: |
In my version of pyodata, the exception you got is raised at the line 2535 but in your case it's line 2451. |
Sorry for this erroneous first feedback, with a fully new fresh installation it works like a charm. |
I came a cross this difference during testing of SAP#95 I decided to set tzinfo of JSON DateTimes to simplify my tests and it also make sense to me to have the values configured the same way.
Only a declared property knows if it accepts Null or not. I was playing with nullable Type but than I would have to have also nullable TypeTraits and there result would be a complete mess. Therefore I decided to move the responsibility to serialize/deserialize the declared property. The decision led to a simpler code which is a good sign. I could have used a better exception type but we currently evaluating the best exception strategies, so I used a generic type. Part of the issue SAP#95
I came a cross this difference during testing of SAP#95 I decided to set tzinfo of JSON DateTimes to simplify my tests and it also make sense to me to have the values configured the same way.
Only a declared property knows if it accepts Null or not. I was playing with nullable Type but than I would have to have also nullable TypeTraits and there result would be a complete mess. Therefore I decided to move the responsibility to serialize/deserialize the declared property. The decision led to a simpler code which is a good sign. I could have used a better exception type but we currently evaluating the best exception strategies, so I used a generic type. Part of the issue SAP#95
I came a cross this difference during testing of #95 I decided to set tzinfo of JSON DateTimes to simplify my tests and it also make sense to me to have the values configured the same way.
Only a declared property knows if it accepts Null or not. I was playing with nullable Type but than I would have to have also nullable TypeTraits and there result would be a complete mess. Therefore I decided to move the responsibility to serialize/deserialize the declared property. The decision led to a simpler code which is a good sign. I could have used a better exception type but we currently evaluating the best exception strategies, so I used a generic type. Part of the issue #95
@bip91 It would help us if you create a new issue for the PATCH vs. MERGE request. |
Latest head works perfectly, I have deployed it instead of my first workaround. I have also isolated the part "MERGE in a vendor request" in #103 |
@bip91 I would not mind if you create a new factory method MS_CRM_client in the vendor module which would return pyodata client correctly configured. |
Yes, of course. I have built MSCRM vendor extension : This works for me with the following code :
The endpoint has changed on more recent Dynamics CRM so the test on URL should be sufficient to avoid mistakes, but I cannot validate this (I have only Dynamics CRM 2015) Feel free to adjust my extension to be coherent with the others. |
I came a cross this difference during testing of SAP#95 I decided to set tzinfo of JSON DateTimes to simplify my tests and it also make sense to me to have the values configured the same way.
Hi,
Thank you for this wonderfull piece of code.
pyodata can also be used successfully with MS CRM 2015 with 2 minors changes :
that raise an exception (At the end of this report)
Is there a way to integrate these changes in a vendor specific python file as it exists for SAP ?
Change made in def from_json(edm_type, value):
This catchs the following errors in MS CRM 2015 to trap None 'Value' :
WARNING:pyodata.model:{'__metadata': {'type': 'Microsoft.Crm.Sdk.Data.Services.EntityReference'}, 'Id': 'f3d1cca6-0313-e711-80be-005056011e04', 'LogicalName': 'systemuser', 'Name': None} WARNING:pyodata.model:{'__metadata': {'type': 'Microsoft.Crm.Sdk.Data.Services.EntityReference'}, 'Id': None, 'LogicalName': None, 'Name': None} WARNING:pyodata.model:{'__metadata': {'type': 'Microsoft.Crm.Sdk.Data.Services.OptionSetValue'}, 'Value': None}
The text was updated successfully, but these errors were encountered: