diff -r 058bb3dc685f -r 0b59724cb3f2 web/views/xbel.py --- a/web/views/xbel.py Mon Jan 04 18:40:30 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. -# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr -# -# This file is part of CubicWeb. -# -# CubicWeb is free software: you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License as published by the Free -# Software Foundation, either version 2.1 of the License, or (at your option) -# any later version. -# -# CubicWeb is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -# details. -# -# You should have received a copy of the GNU Lesser General Public License along -# with CubicWeb. If not, see . -"""xbel views""" - -__docformat__ = "restructuredtext en" -from cubicweb import _ - -from six.moves import range - -from logilab.mtconverter import xml_escape - -from cubicweb.predicates import is_instance -from cubicweb.view import EntityView -from cubicweb.web.views.xmlrss import XMLView - - -class XbelView(XMLView): - __regid__ = 'xbel' - title = _('xbel export') - templatable = False - content_type = 'text/xml' #application/xbel+xml - - def cell_call(self, row, col): - self.wview('xbelitem', self.cw_rset, row=row, col=col) - - def call(self): - """display a list of entities by calling their view""" - self.w(u'\n' % self._cw.encoding) - self.w(u'') - self.w(u'') - self.w(u'%s' % self._cw._('bookmarks')) - for i in range(self.cw_rset.rowcount): - self.cell_call(i, 0) - self.w(u"") - - -class XbelItemView(EntityView): - __regid__ = 'xbelitem' - - def cell_call(self, row, col): - entity = self.cw_rset.complete_entity(row, col) - self.w(u'' % xml_escape(self.url(entity))) - self.w(u' %s' % xml_escape(entity.dc_title())) - self.w(u'') - - def url(self, entity): - return entity.absolute_url() - - -class XbelItemBookmarkView(XbelItemView): - __select__ = is_instance('Bookmark') - - def url(self, entity): - return entity.actual_url()