예제 #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')