开发者

python serialization of objects on appengine

开发者 https://www.devze.com 2023-02-24 12:47 出处:网络
I wanted to serialize an object in xml for a client application from app-engine. I started using the django 1.2 serialization described here:

I wanted to serialize an object in xml for a client application from app-engine. I started using the django 1.2 serialization described here:

http://docs.djangoproject.com/en/1.2/topics/serialization/

from django.core import serializers
....

data = serializers.serialize("xml", TestObject.all())

It raises the following error:

raise base.SerializationError("Non-model object (%s) encountered during serialization" %   type(obj))
SerializationError: Non-model object () encountered during serial开发者_C百科ization

which I assume is django not liking the app-engine db.Model objects. Is there another way to go about this?


Do you need the XML to be in a specific format? All db.Model objects have a built-in to_xml() method that conforms to Atom & GData specs. Is that useful?

0

精彩评论

暂无评论...
验证码 换一张
取 消