web/views/xmlrss.py
changeset 10609 e2d8e81bfe68
parent 10245 7d21c6ac47a3
child 10666 7f6b5f023884
equal deleted inserted replaced
10608:7fc548d9dd8e 10609:e2d8e81bfe68
    20 __docformat__ = "restructuredtext en"
    20 __docformat__ = "restructuredtext en"
    21 _ = unicode
    21 _ = unicode
    22 
    22 
    23 from base64 import b64encode
    23 from base64 import b64encode
    24 from time import timezone
    24 from time import timezone
       
    25 
       
    26 from six.moves import range
    25 
    27 
    26 from logilab.mtconverter import xml_escape
    28 from logilab.mtconverter import xml_escape
    27 
    29 
    28 from cubicweb.predicates import (is_instance, non_final_entity, one_line_rset,
    30 from cubicweb.predicates import (is_instance, non_final_entity, one_line_rset,
    29                                 appobject_selectable, adaptable)
    31                                 appobject_selectable, adaptable)
    62 
    64 
    63     def call(self):
    65     def call(self):
    64         """display a list of entities by calling their <item_vid> view"""
    66         """display a list of entities by calling their <item_vid> view"""
    65         self.w(u'<?xml version="1.0" encoding="%s"?>\n' % self._cw.encoding)
    67         self.w(u'<?xml version="1.0" encoding="%s"?>\n' % self._cw.encoding)
    66         self.w(u'<%s size="%s">\n' % (self.xml_root, len(self.cw_rset)))
    68         self.w(u'<%s size="%s">\n' % (self.xml_root, len(self.cw_rset)))
    67         for i in xrange(self.cw_rset.rowcount):
    69         for i in range(self.cw_rset.rowcount):
    68             self.cell_call(i, 0)
    70             self.cell_call(i, 0)
    69         self.w(u'</%s>\n' % self.xml_root)
    71         self.w(u'</%s>\n' % self.xml_root)
    70 
    72 
    71 
    73 
    72 class XMLItemView(EntityView):
    74 class XMLItemView(EntityView):
   254         self.w(u'</rss>')
   256         self.w(u'</rss>')
   255 
   257 
   256     def call(self):
   258     def call(self):
   257         """display a list of entities by calling their <item_vid> view"""
   259         """display a list of entities by calling their <item_vid> view"""
   258         self._open()
   260         self._open()
   259         for i in xrange(self.cw_rset.rowcount):
   261         for i in range(self.cw_rset.rowcount):
   260             self.cell_call(i, 0)
   262             self.cell_call(i, 0)
   261         self._close()
   263         self._close()
   262 
   264 
   263     def cell_call(self, row, col):
   265     def cell_call(self, row, col):
   264         self.wview(self.item_vid, self.cw_rset, row=row, col=col)
   266         self.wview(self.item_vid, self.cw_rset, row=row, col=col)