Пример #1
0
    def test_tree_serialize(self):
        """test serialization of models with foreign keys"""
        ser = RecursiveXmlSerializer()
        res = TestModel.objects.all()
        xml = ser.serialize(res)

        assert (md5(xml).hexdigest() == CONFIRMED_XML_DIGEST)
Пример #2
0
    def test_tree_serialize(self):
        """test serialization of models with foreign keys"""
        ser = RecursiveXmlSerializer()
        res = TestModel.objects.all()
        xml = ser.serialize(res)

        assert md5(xml).hexdigest() == CONFIRMED_XML_DIGEST
Пример #3
0
 def test___serialize__(self):
     "A model with a __serialize__ method should serialize it self"
     tags = TagModel.objects.all().order_by('id')
     ser = RecursiveXmlSerializer()
     self.assertEqual(
         ser.serialize(tags),
         '<django-objects version="1.0"><taggy>good</taggy><taggy>bad</taggy><taggy>ugly</taggy></django-objects>'
     )
Пример #4
0
 def test___serialize__(self):
     "A model with a __serialize__ method should serialize it self"
     tags = TagModel.objects.all().order_by("id")
     ser = RecursiveXmlSerializer()
     self.assertEqual(
         ser.serialize(tags),
         '<django-objects version="1.0"><taggy>good</taggy><taggy>bad</taggy><taggy>ugly</taggy></django-objects>',
     )
Пример #5
0
 def __xml__(self):
     """turn querysets into xml recursively"""
     ser = RecursiveXmlSerializer()
     return ser.serialize(self)
Пример #6
0
 def __xml__(self):
     """turn querysets into xml recursively"""
     ser = RecursiveXmlSerializer()
     return ser.serialize(self)
Пример #7
0
 def __xml__(self):
     """turn model object into xml recursively"""
     ser = RecursiveXmlSerializer()
     return ser.serialize([self])
def feed(request):
    ser = RecursiveXmlSerializer()
    return HttpResponse(ser.serialize(PageBase.objects.all()), mimetype='text/xml')