20 title = _('xbel') |
20 title = _('xbel') |
21 templatable = False |
21 templatable = False |
22 content_type = 'text/xml' #application/xbel+xml |
22 content_type = 'text/xml' #application/xbel+xml |
23 |
23 |
24 def cell_call(self, row, col): |
24 def cell_call(self, row, col): |
25 self.wview('xbelitem', self.rset, row=row, col=col) |
25 self.wview('xbelitem', self.cw_rset, row=row, col=col) |
26 |
26 |
27 def call(self): |
27 def call(self): |
28 """display a list of entities by calling their <item_vid> view""" |
28 """display a list of entities by calling their <item_vid> view""" |
29 title = self.page_title() |
29 title = self.page_title() |
30 url = self.build_url(rql=self.req.form.get('rql', '')) |
30 url = self._cw.build_url(rql=self._cw.form.get('rql', '')) |
31 self.w(u'<?xml version="1.0" encoding="%s"?>\n' % self.req.encoding) |
31 self.w(u'<?xml version="1.0" encoding="%s"?>\n' % self._cw.encoding) |
32 self.w(u'<!DOCTYPE xbel PUBLIC "+//IDN python.org//DTD XML Bookmark Exchange Language 1.0//EN//XML" "http://www.python.org/topics/xml/dtds/xbel-1.0.dtd">') |
32 self.w(u'<!DOCTYPE xbel PUBLIC "+//IDN python.org//DTD XML Bookmark Exchange Language 1.0//EN//XML" "http://www.python.org/topics/xml/dtds/xbel-1.0.dtd">') |
33 self.w(u'<xbel version="1.0">') |
33 self.w(u'<xbel version="1.0">') |
34 self.w(u'<title>%s</title>' % self.req._('bookmarks')) |
34 self.w(u'<title>%s</title>' % self._cw._('bookmarks')) |
35 for i in xrange(self.rset.rowcount): |
35 for i in xrange(self.cw_rset.rowcount): |
36 self.cell_call(i, 0) |
36 self.cell_call(i, 0) |
37 self.w(u"</xbel>") |
37 self.w(u"</xbel>") |
38 |
38 |
39 |
39 |
40 class XbelItemView(EntityView): |
40 class XbelItemView(EntityView): |
41 __regid__ = 'xbelitem' |
41 __regid__ = 'xbelitem' |
42 |
42 |
43 def cell_call(self, row, col): |
43 def cell_call(self, row, col): |
44 entity = self.complete_entity(row, col) |
44 entity = self.cw_rset.complete_entity(row, col) |
45 self.w(u'<bookmark href="%s">' % xml_escape(self.url(entity))) |
45 self.w(u'<bookmark href="%s">' % xml_escape(self.url(entity))) |
46 self.w(u' <title>%s</title>' % xml_escape(entity.dc_title())) |
46 self.w(u' <title>%s</title>' % xml_escape(entity.dc_title())) |
47 self.w(u'</bookmark>') |
47 self.w(u'</bookmark>') |
48 |
48 |
49 def url(self, entity): |
49 def url(self, entity): |