How to deserialize xml created by to_xml () in google appengine

In the Google App Engine, I can serialize an object by calling its to_xml () method. There is no equivalent from_xml () method for xml deserialization. Is there an effective way to deserialize back to an object?

+4
source share
1 answer

To clarify, I'm going to suggest that you are asking about the Model.to_xml () method, and that by efficient you mean one method that you can name that will provide you with a model object.

As you noted, there is no such class in the Model class for the data warehouse API. I think the goal is that the goal of the XML method is to make the model easily exportable to another application, such as a javascript client, or to import into another database or storage engine, similar to using the remote API.

It should be possible to create a function or static method of a specific class Model, which will generate a new model of a certain type from XML parsing. Then you most likely want to do get_or_insert () to write the resulting object.

If you are looking for your own Python serialization method for Python, you can consider pickle.

0
source

Source: https://habr.com/ru/post/1500590/


All Articles