orientechnologies / pyorient

OrientDB driver for Python that uses the binary protocol.
Apache License 2.0
119 stars 38 forks source link

Fix for serialization issue of embeddedlist documents #21

Closed james-kennedy closed 7 years ago

james-kennedy commented 7 years ago

This is my first pull request on Github, so my apologies if any information is missing...

I ran into a bug when returning an embeddedlist of a document class from the client.command() function. If the first entry of the embedded document class is not a string, then the key/value pairs in the dictionary would be wrong. I stepped through the code to the serialization.py file. When returning the item, the first key is fetched as part of an if clause. Either route through the 'if' will result in getting the first key. After exiting the 'if', the next line (478) also tries to get a key (_parse_key(content)). If the value is a string then it is fine because parse key checks for : or ". If it is another type, e.g., a double or a float, then the parsing carries on until after the next key. This then causes some subsequent key/value fetches to be out of sync too. I changed the code so that instead of getting a key, and then another key, it now gets a key and then a value.

Ostico commented 7 years ago

Thank you @james-kennedy ,

but i have to refuse, this was already fixed in development branch.