# HG changeset patch # User sylvain.thenault@logilab.fr # Date 1234513818 -3600 # Node ID b1ea90dc7408ff0d8de8c42abae7111b755622ad # Parent e059279de6cffcb017e0e8865e77882db10f9512# Parent 853351c6e207d737c988a3e91df253c050c36905 merge diff -r e059279de6cf -r b1ea90dc7408 web/views/linkedData.py --- a/web/views/linkedData.py Fri Feb 13 09:30:04 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -from logilab.mtconverter import html_escape - -from cubicweb.common.view import EntityView - -from urlparse import urlparse - -class LinkedDataProjectView(EntityView): - id = 'project_linked_data' - title = _('Project linked data') - accepts = ('Project',) - templatable = False - content_type = 'text/xml' - - def call(self): - '''display all project attribut and project dependencies and external project (in doap format) if - it is related to''' - - self.w(u'\n' % self.req.encoding) - self.w(u'''\n''') - for i in xrange(self.rset.rowcount): - self.cell_call(row=i, col=0) - self.w(u'\n') - - def cell_call(self, row, col): - self.wview('project_linked_data_item', self.rset, row=row, col=col) - -class LinkedDataProjectItemView(EntityView): - id = 'project_linked_data_item' - accepts = ('Project',) - - def cell_call(self, row, col): - entity = self.complete_entity(row, col) - self.w(u'\n' % html_escape(entity.absolute_url())) - self.w(u' %s\n' % html_escape(unicode(entity.dc_title()))) - self.w(u' %s\n' % (entity.creation_date.strftime('%Y-%m-%d'))) - self.w(u' %s\n' % html_escape(unicode(entity.summary))) - self.w(u' %s\n' % html_escape(unicode(entity.description))) - self.w(u' %s\n' % html_escape(entity.url or entity.absolute_url())) - if entity.modification_date: - self.w(u'%s\n'% (entity.modification_date.strftime('%Y-%m-%d'))) - if entity.vcsurl: - self.w(u''' - - ''' % html_escape(entity.vcsurl)) - if entity.reporturl: - self.w(u'"%s"' % html_escape(entity.vcsurl)) - - if entity.downloadurl: - self.w(u' %s\n' % html_escape(entity.downloadurl)) - liste = urlparse(entity.absolute_url()) - internal_address = liste[1] - for externalproject in entity.uses: - self.w(u'\n') - if externalproject.e_schema == 'ExtProject': - if externalproject.absolute_url().find(internal_address) > 0: - self.w(u'') - self.w(u' %s'% externalproject.absolute_url()) - else: - self.w(u'%s'% externalproject.absolute_url()) - self.w(u'\n') - for externalproject in entity.recommends: - self.w(u'\n') - if externalproject.e_schema == 'ExtProject': - if externalproject.absolute_url().find(internal_address) > 0: - self.w(u'') - self.w(u'%s'% externalproject.absolute_url()) - else: - self.w(u'%s'% externalproject.absolute_url()) - self.w(u'%s'% externalproject.absolute_url()) - - self.w(u'\n') - -