le patch move-pdf-export-to-cubes a été importé
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 08 Apr 2010 13:38:36 +0200
changeset 5195 e8235b2789fc
parent 5184 955ee1b24756
child 5196 d14bfd477c44
le patch move-pdf-export-to-cubes a été importé
__pkginfo__.py
debian/control
ext/xhtml2fo.py
i18n/en.po
i18n/es.po
i18n/fr.po
utils.py
web/data/pdf_icon.gif
web/test/data/sample1.pdf
web/test/data/sample1.xml
web/test/unittest_pdf.py
web/views/basecomponents.py
web/views/basetemplates.py
--- a/__pkginfo__.py	Thu Apr 08 11:04:17 2010 +0200
+++ b/__pkginfo__.py	Thu Apr 08 13:38:36 2010 +0200
@@ -46,8 +46,6 @@
     'PIL': '',                  # for captcha
     'pycrypto': '',             # for crypto extensions
     'fyzz': '>= 0.1.0',         # for sparql
-    'pysixt': '>= 0.1.0',       # XXX for pdf export
-    'python-gettext': '>= 1.0', # XXX for pdf export
     'vobject': '>= 0.6.0',      # for ical view
     #'Products.FCKeditor':'',
     #'SimpleTAL':'>= 4.1.6',
--- a/debian/control	Thu Apr 08 11:04:17 2010 +0200
+++ b/debian/control	Thu Apr 08 13:38:36 2010 +0200
@@ -83,7 +83,7 @@
 Architecture: all
 XB-Python-Version: ${python:Versions}
 Depends: ${python:Depends}, cubicweb-common (= ${source:Version}), python-simplejson (>= 1.3)
-Recommends: python-docutils, python-vobject, fckeditor, python-fyzz, python-pysixt, fop, python-imaging
+Recommends: python-docutils, python-vobject, fckeditor, python-fyzz, python-imaging
 Description: web interface library for the CubicWeb framework
  CubicWeb is a semantic web application framework.
  .
--- a/ext/xhtml2fo.py	Thu Apr 08 11:04:17 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-from xml.etree.ElementTree import QName
-from pysixt.standard.xhtml_xslfo.transformer import XHTML2FOTransformer
-from pysixt.utils.xslfo.standard import cm
-from pysixt.utils.xslfo import SimplePageMaster
-from pysixt.standard.xhtml_xslfo.default_styling import default_styles
-from pysixt.standard.xhtml_xslfo import XHTML_NS
-
-
-class ReportTransformer(XHTML2FOTransformer):
-    """
-    Class transforming an XHTML input tree into a FO document
-    displaying reports (one report for each <div class="contentmain">
-    element in the input tree.
-    """
-
-    def __init__(self, section,
-                 page_width=21.0, page_height=29.7,
-                 margin_top=1.0, margin_bottom=1.0,
-                 margin_left=1.0, margin_right=1.0,
-                 header_footer_height=0.75,
-                 standard_font_size=11.0, default_lang=u"fr" ):
-        """
-        Initializes a transformer turning an XHTML input tree
-        containing <div class="contentmain"> elements representing
-        main content sections into a FO output tree displaying the
-        reports.
-
-        page_width: float - width of the page (in cm)
-        page_height: float - height of the page (in cm)
-        margin_top: float - top margin of the page (in cm)
-        margin_bottom: float - bottom margin of the page (in cm)
-        margin_left: float - left margin of the page (in cm)
-        margin_right: float - right margin of the page (in cm)
-        header_footer_height: float - height of the header or the footer of the
-                              page that the page number (if any) will be
-                              inserted in.
-        standard_font_size: float - standard size of the font (in pt)
-        default_lang: u"" - default language (used for hyphenation)
-        """
-        self.section = section
-        self.page_width = page_width
-        self.page_height = page_height
-
-        self.page_tmargin = margin_top
-        self.page_bmargin = margin_bottom
-        self.page_lmargin = margin_left
-        self.page_rmargin = margin_right
-
-        self.hf_height = header_footer_height
-
-        self.font_size = standard_font_size
-        self.lang = default_lang
-
-        XHTML2FOTransformer.__init__(self)
-
-
-    def define_pagemasters(self):
-        """
-        Defines the page masters for the FO output document.
-        """
-        pm = SimplePageMaster(u"page-report")
-        pm.set_page_dims( self.page_width*cm, self.page_height*cm )
-        pm.set_page_margins({u'top'   : self.page_tmargin*cm,
-                             u'bottom': self.page_bmargin*cm,
-                             u'left'  : self.page_lmargin*cm,
-                             u'right' : self.page_rmargin*cm })
-        pm.add_peripheral_region(u"end", self.hf_height)
-        dims = {}
-        dims[u"bottom"] = self.hf_height + 0.25
-        pm.set_main_region_margins(dims)
-        return [pm]
-
-    def _visit_report(self, in_elt, _out_elt, params):
-        """
-        Specific visit function for the input <div> elements whose class is
-        "report". The _root_visit method of this class selects these input
-        elements and asks the process of these elements with this specific
-        visit function.
-        """
-
-        ps = self.create_pagesequence(u"page-report")
-        props = { u"force-page-count": u"no-force",
-                  u"initial-page-number": u"1",
-                  u"format": u"1", }
-        self._output_properties(ps, props)
-
-        sc = self.create_staticcontent(ps, u"end")
-        sc_bl = self.create_block(sc)
-        attrs = { u"hyphenate": u"false", }
-        attrs[u"font-size"] = u"%.1fpt" % (self.font_size * 0.7)
-        attrs[u"language"] = self.lang
-        attrs[u"text-align"] = u"center"
-        self._output_properties(sc_bl, attrs)
-        sc_bl.text = u"Page" + u" " # ### Should be localised!
-        pn = self.create_pagenumber(sc_bl)
-        pn.tail = u"/"
-        self.create_pagenumbercitation(
-            sc_bl, u"last-block-of-report-%d" % params[u"context_pos"])
-
-        fl = self.create_flow(ps, u"body")
-        bl = self.create_block(fl)
-
-        # Sets on the highest block element the properties of the XHTML body
-        # element. These properties (at the least the inheritable ones) will
-        # be inherited by all the future FO elements.
-        bodies = list(self.in_tree.getiterator(QName(XHTML_NS, u"body")))
-        if len(bodies) > 0:
-            attrs = self._extract_properties([bodies[0]])
-        else:
-            attrs = default_styles[u"body"].copy()
-        attrs[u"font-size"] = u"%.1fpt" % self.font_size
-        attrs[u"language"] = self.lang
-        self._output_properties(bl,attrs)
-
-        # Processes the report content
-        self._copy_text(in_elt, bl)
-        self._process_nodes(in_elt.getchildren(), bl)
-
-        # Inserts an empty block at the end of the report in order to be able
-        # to compute the last page number of this report.
-        last_bl = self.create_block(bl)
-        props = { u"keep-with-previous": u"always", }
-        props[u"id"] = u"last-block-of-report-%d" % params[u"context_pos"]
-        self._output_properties(last_bl,props)
-
-
-    def _root_visit(self):
-        """
-        Visit function called when starting the process of the input tree.
-        """
-        content = [ d for d in self.in_tree.getiterator(QName(XHTML_NS, u"div"))
-                    if d.get(u"id") == self.section ]
-        # Asks the process of the report elements with a specific visit
-        # function
-        self._process_nodes(content, self.fo_root,
-                            with_function=self._visit_report)
-
--- a/i18n/en.po	Thu Apr 08 11:04:17 2010 +0200
+++ b/i18n/en.po	Thu Apr 08 13:38:36 2010 +0200
@@ -368,9 +368,6 @@
 msgid "Do you want to delete the following element(s) ?"
 msgstr ""
 
-msgid "Download page as pdf"
-msgstr ""
-
 msgctxt "inlined:CWUser.use_email.subject"
 msgid "EmailAddress"
 msgstr "Email address"
@@ -1578,12 +1575,6 @@
 msgid "contentnavigation_metadata_description"
 msgstr ""
 
-msgid "contentnavigation_pdfview"
-msgstr "view page as pdf icon"
-
-msgid "contentnavigation_pdfview_description"
-msgstr ""
-
 msgid "contentnavigation_prevnext"
 msgstr "previous / next entity"
 
--- a/i18n/es.po	Thu Apr 08 11:04:17 2010 +0200
+++ b/i18n/es.po	Thu Apr 08 13:38:36 2010 +0200
@@ -376,9 +376,6 @@
 msgid "Do you want to delete the following element(s) ?"
 msgstr "Desea suprimir el(los) elemento(s) siguiente(s)"
 
-msgid "Download page as pdf"
-msgstr ""
-
 msgctxt "inlined:CWUser.use_email.subject"
 msgid "EmailAddress"
 msgstr ""
@@ -1609,12 +1606,6 @@
 msgid "contentnavigation_metadata_description"
 msgstr ""
 
-msgid "contentnavigation_pdfview"
-msgstr ""
-
-msgid "contentnavigation_pdfview_description"
-msgstr ""
-
 msgid "contentnavigation_prevnext"
 msgstr "Elemento anterior / siguiente"
 
--- a/i18n/fr.po	Thu Apr 08 11:04:17 2010 +0200
+++ b/i18n/fr.po	Thu Apr 08 13:38:36 2010 +0200
@@ -387,9 +387,6 @@
 msgid "Do you want to delete the following element(s) ?"
 msgstr "Voulez-vous supprimer le(s) élément(s) suivant(s) ?"
 
-msgid "Download page as pdf"
-msgstr "télécharger la page au format PDF"
-
 msgctxt "inlined:CWUser.use_email.subject"
 msgid "EmailAddress"
 msgstr "Adresse électronique"
@@ -1630,12 +1627,6 @@
 msgid "contentnavigation_metadata_description"
 msgstr ""
 
-msgid "contentnavigation_pdfview"
-msgstr "icône pdf"
-
-msgid "contentnavigation_pdfview_description"
-msgstr ""
-
 msgid "contentnavigation_prevnext"
 msgstr "élément précedent / suivant"
 
--- a/utils.py	Thu Apr 08 11:04:17 2010 +0200
+++ b/utils.py	Thu Apr 08 13:38:36 2010 +0200
@@ -309,35 +309,6 @@
                                                  self.body.getvalue())
 
 
-def _pdf_conversion_availability():
-    try:
-        import pysixt
-    except ImportError:
-        return False
-    from subprocess import Popen, STDOUT
-    if not os.path.isfile('/usr/bin/fop'):
-        return False
-    try:
-        Popen(['/usr/bin/fop', '-q'],
-              stdout=open(os.devnull, 'w'),
-              stderr=STDOUT)
-    except OSError, e:
-        getLogger('cubicweb').info('fop not usable (%s)', e)
-        return False
-    return True
-
-def can_do_pdf_conversion(__answer_cache=[]):
-    """pdf conversion depends on
-    * pysixt (python package)
-    * fop 0.9x
-
-    NOTE: actual check is done by _pdf_conversion_availability and
-    result is cached
-    """
-    if not __answer_cache: # first time, not in cache
-        __answer_cache.append(_pdf_conversion_availability())
-    return __answer_cache[0]
-
 try:
     # may not be there if cubicweb-web not installed
     from simplejson import dumps, JSONEncoder
Binary file web/data/pdf_icon.gif has changed
Binary file web/test/data/sample1.pdf has changed
--- a/web/test/data/sample1.xml	Thu Apr 08 11:04:17 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" [
-  <!ATTLIST html xmlns:cubicweb CDATA  #FIXED 'http://www.logilab.org/2008/cubicweb'  >
-
-<!ENTITY % coreattrs
- "id          ID            #IMPLIED
-  class       CDATA         #IMPLIED
-  style       CDATA         #IMPLIED
-  title       CDATA         #IMPLIED
-
- cubicweb:sortvalue         CDATA   #IMPLIED
- cubicweb:target            CDATA   #IMPLIED
- cubicweb:limit             CDATA   #IMPLIED
- cubicweb:type              CDATA   #IMPLIED
- cubicweb:loadtype          CDATA   #IMPLIED
- cubicweb:wdgtype           CDATA   #IMPLIED
- cubicweb:initfunc          CDATA   #IMPLIED
- cubicweb:inputid           CDATA   #IMPLIED
- cubicweb:tindex            CDATA   #IMPLIED
- cubicweb:inputname         CDATA   #IMPLIED
- cubicweb:value             CDATA   #IMPLIED
- cubicweb:required          CDATA   #IMPLIED
- cubicweb:accesskey         CDATA   #IMPLIED
- cubicweb:maxlength         CDATA   #IMPLIED
- cubicweb:variables         CDATA   #IMPLIED
- cubicweb:displayactions    CDATA   #IMPLIED
- cubicweb:fallbackvid       CDATA   #IMPLIED
- cubicweb:fname             CDATA   #IMPLIED
- cubicweb:vid               CDATA   #IMPLIED
- cubicweb:rql               CDATA   #IMPLIED
- cubicweb:actualrql         CDATA   #IMPLIED
- cubicweb:rooteid           CDATA   #IMPLIED
- cubicweb:dataurl           CDATA   #IMPLIED
- cubicweb:size              CDATA   #IMPLIED
- cubicweb:tlunit            CDATA   #IMPLIED
- cubicweb:loadurl           CDATA   #IMPLIED
- cubicweb:uselabel          CDATA   #IMPLIED
- cubicweb:facetargs         CDATA   #IMPLIED
- cubicweb:facetName         CDATA   #IMPLIED
-  "> ] >
-
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:cubicweb="http://www.logilab.org/2008/cubicweb" xml:lang="fr" lang="fr">
-<head>
-<base href="http://crater:8888/"></base><meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8"/>
-<meta name="ROBOTS" content="NOINDEX" />
-<link rel="shortcut icon" href="http://crater:8888/data0ea37b3fea72bf4b2fde96c64e51f626/favicon.ico"/>
-<link rel="alternate" type="application/rss+xml" title="RSS feed" href="http://crater:8888/project/Comet/0.2.0?vid=rss"/>
-<title>Comet 0.2.0 (unset title)</title>
-<script type="text/javascript"><!--//--><![CDATA[//><!--
-pageid = "0499a5d7add13919a458db30006d9832";
-//--><!]]></script>
-<link rel="stylesheet" type="text/css" media="all" href="http://crater:8888/data0ea37b3fea72bf4b2fde96c64e51f626/cubes.tracker.css"/>
-<link rel="stylesheet" type="text/css" media="print" href="http://crater:8888/data0ea37b3fea72bf4b2fde96c64e51f626/cubicweb.print.css"/>
-<link rel="stylesheet" type="text/css" media="all" href="http://crater:8888/data0ea37b3fea72bf4b2fde96c64e51f626/cubicweb.login.css"/>
-<script type="text/javascript" src="http://crater:8888/data0ea37b3fea72bf4b2fde96c64e51f626/jquery.js"></script>
-<script type="text/javascript" src="http://crater:8888/data0ea37b3fea72bf4b2fde96c64e51f626/jquery.corner.js"></script>
-<script type="text/javascript" src="http://crater:8888/data0ea37b3fea72bf4b2fde96c64e51f626/jquery.json.js"></script>
-<script type="text/javascript" src="http://crater:8888/data0ea37b3fea72bf4b2fde96c64e51f626/cubicweb.compat.js"></script>
-<script type="text/javascript" src="http://crater:8888/data0ea37b3fea72bf4b2fde96c64e51f626/cubicweb.python.js"></script>
-<script type="text/javascript" src="http://crater:8888/data0ea37b3fea72bf4b2fde96c64e51f626/cubicweb.htmlhelpers.js"></script>
-<script type="text/javascript" src="http://crater:8888/data0ea37b3fea72bf4b2fde96c64e51f626/cubicweb.ajax.js"></script>
-<script type="text/javascript" src="http://crater:8888/data0ea37b3fea72bf4b2fde96c64e51f626/cubicweb.bookmarks.js"></script>
-<script type="text/javascript">
-jQuery(document).ready(function () {
- jQuery("#__login:visible").focus()
- });
-</script>
-</head>
-
-<body>
-<table id="header"><tr>
-<td id="firstcolumn"><a href="http://crater:8888/"><img class="logo" src="http://crater:8888/data0ea37b3fea72bf4b2fde96c64e51f626/logo.png" alt="logo"/></a></td>
-<td id="headtext"><span id="appliName"><a href="http://crater:8888/">unset title</a></span><span class="pathbar">&#160;&gt;&#160;<a href="http://crater:8888/Project">projets</a>&#160;&gt;&#160;<a href="http://crater:8888/project/Comet" title="">Comet</a>&#160;&gt;&#160;
-0.2.0</span></td><td>
-anonyme&#160;[<a class="logout" href="javascript: popupLoginBox();">s'authentifier</a>]</td><td><a href="http://crater:8888/doc/main" class="help" title="aide">&#160;</a></td><td id="lastcolumn"></td>
-</tr></table>
-<div id="popupLoginBox" class="hidden"><div id="loginContent">
-<form method="post" action="http://crater:8888/project/Comet/0.2.0?vid=statussheet" id="login_form">
-<table>
-<tr>
-<td><label for="__login">identifiant</label></td><td><input name="__login" id="__login" class="data" type="text" /></td></tr><tr>
-<td><label for="__password" >mot de passe</label></td><td><input name="__password" id="__password" class="data" type="password" /></td>
-</tr><tr>
-<td>&#160;</td><td><input type="submit" class="loginButton right" value="s'identifier" />
-</td></tr>
-</table>
-</form>
-</div></div>
-
-  <div id="stateheader">
-  </div>
-  <div id="page"><table width="100%" border="0" id="mainLayout"><tr>
-<td class="navcol"><div class="navboxes">
-<div class="searchBoxFrame" id="search_box"><div class="boxTitle"><span><span onclick="javascript: toggleVisibility('rqlinput')">rechercher</span></span></div><div class="boxContent">
-<form action="http://crater:8888/view">
-<table id="tsearch"><tr><td>
-<input id="norql" type="text" accesskey="q" tabindex="1" title="search text" value="" name="rql" />
-<input type="hidden" name="__fromsearchbox" value="1" />
-<input type="hidden" name="subvid" value="tsearch" />
-</td><td>
-<input tabindex="2" type="submit" id="rqlboxsubmit" class="rqlsubmit" value="" />
-</td></tr></table>
-</form></div>
-<div class="shadow">&#160;</div></div><div class="greyBoxFrame" id="edit_box"><div class="boxTitle"><span>actions - version</span></div><div class="boxContent">
-<ul class="boxListing"><li class="boxMainactions"><a href="http://crater:8888/project/Comet/0.2.0" title="keyword: view">voir</a></li>
-<li class="boxMainactions"><a href="http://crater:8888/project/Comet/0.2.0?vid=edition" title="keyword: edit">modifier</a></li>
-<li class="boxMainactions"><a title="aucune transition possible">état: <i>en cours</i></a></li><li><a href="javascript: toggleVisibility('boxmenu_ajouter')" class="boxMenu">ajouter</a><ul id="boxmenu_ajouter" class="hidden"><li class="boxItem"><a href="http://crater:8888/project/Comet/0.2.0?etype=Ticket&amp;__linkto=done_in%3A789%3Asubject&amp;__redirectvid=statussheet&amp;__redirectpath=project%2FComet%2F0.2.0&amp;vid=creation" title="">ticket</a></li>
-<li class="boxItem"><a href="http://crater:8888/project/Comet/0.2.0?etype=Ticket&amp;__linkto=appeared_in%3A789%3Asubject&amp;__redirectvid=statussheet&amp;__redirectpath=project%2FComet%2F0.2.0&amp;vid=creation" title="">signaler une anomalie</a></li>
-</ul></li><li><a href="javascript: toggleVisibility('boxmenu_plus_dactions')" class="boxMenu">plus d'actions</a><ul id="boxmenu_plus_dactions" class="hidden"><li class="boxMoreactions"><a href="http://crater:8888/project/Comet/0.2.0?vid=security" title="keyword: managepermission">gestion des permissions</a></li>
-<li class="boxMoreactions"><a href="http://crater:8888/project/Comet/0.2.0?vid=deleteconf" title="keyword: delete">supprimer</a></li>
-<li class="boxMoreactions"><a href="http://crater:8888/project/Comet/0.2.0?vid=copy" title="keyword: copy">copier</a></li>
-<li class="boxMoreactions"><a href="http://crater:8888/view?rql=Any%20X%20WHERE%20X%20version_of%20P%2C%20P%20name%20%22Comet%22%2C%20X%20num%20%220.2.0%22%2C%20X%20is%20Version&amp;template=pdf-main-template" title="keyword: pdfexport">export pdf</a></li>
-<li class="boxMoreactions"><a href="http://crater:8888/project/Comet/0.2.0?vid=document" title="keyword: pvrestexport">export ReST</a></li>
-</ul></li></ul>
-</div>
-<div class="shadow">&#160;</div></div><div class="boxFrame" id="bookmarks_box"><div class="boxTitle"><span>signets</span></div><div class="boxContent">
-<ul class="sideBox"><li><a href="javascript: toggleVisibility('boxmenu_gérer_les_signets')" class="boxMenu">gérer les signets</a><ul id="boxmenu_gérer_les_signets" class="hidden"><li class="boxManage"><a href="http://crater:8888/add/Bookmark?__linkto=bookmarked_by%3A5%3Asubject&amp;path=project%2FComet%2F0.2.0%3Fvid%3Dstatussheet" title="keyword: bookmark">poser un signet ici</a></li>
-<li class="boxManage"><a href="http://crater:8888/cwuser/admin?target=subject&amp;vid=xaddrelation&amp;rtype=bookmarked_by" title="">récupérer des signets existants</a></li>
-</ul></li></ul>
-</div>
-<div class="shadow">&#160;</div></div></div></td>
-<td id="contentcol">
-<div id="rqlinput" class="hidden">
-          <form action="http://crater:8888/view">
-<fieldset>
-<input type="text" id="rql" name="rql" value="Any X WHERE X version_of P, P name &quot;Comet&quot;, X num &quot;0.2.0&quot;, X is Version"  title="texte à rechercher ou requête RQL" tabindex="3" accesskey="q" class="searchField" />
-<input type="submit" value="" class="rqlsubmit" tabindex="4" />
-</fieldset>
-</form></div><div id="appMsg" onclick="javascript: toggleVisibility('appMsg')" class="hidden">
-</div><div id="pageContent">
-<div id="contentmain">
-<h2>Fiche de statut</h2><table class="listing"><tr><th rowspan="2">Projets</th><th colspan="2">Version</th><th rowspan="2">Parent</th><th rowspan="2">Tickets ouverts</th><th rowspan="2">Tickets implémentés</th><th rowspan="2">Statut</th></tr><tr><th>actuelle</th><th>ciblée</th></tr><tr><td title=""><a href="http://crater:8888/project/Developper%20manual" title="">Developper manual</a></td><td><a href="http://crater:8888/project/Developper%20manual/0.1.0">0.1.0</a></td><td><a href="http://crater:8888/project/Developper%20manual/0.2.0">0.2.0</a></td><td><a href="http://crater:8888/project/Comet%20documentation" title="">Comet documentation</a></td><td><div title="detail a bit configuration steps"><a href="http://crater:8888/ticket/803">T 803</a></div></td><td></td><td>en cours</td></tr><tr><td title=""><a href="http://crater:8888/project/User%20manual" title="">User manual</a></td><td><a href="http://crater:8888/project/User%20manual/0.2.0">0.2.0</a></td><td><a href="http://crater:8888/project/User%20manual/0.2.0">0.2.0</a></td><td><a href="http://crater:8888/project/Comet%20documentation" title="">Comet documentation</a></td><td></td><td><div title="write a tutorial"><a href="http://crater:8888/ticket/801">T 801</a></div></td><td>livrée</td></tr><tr><td title=""><a href="http://crater:8888/project/Comet%20documentation" title="">Comet documentation</a></td><td><a href="http://crater:8888/project/Comet%20documentation/0.1.0">0.1.0</a></td><td><a href="http://crater:8888/project/Comet%20documentation/0.2.0">0.2.0</a></td><td><a href="http://crater:8888/project/Comet" title="">Comet</a></td><td></td><td></td><td>en cours</td></tr><tr><td title=""><a href="http://crater:8888/project/Lgc" title="">Lgc</a></td><td><a href="http://crater:8888/project/Lgc/0.2.0">0.2.0</a></td><td><a href="http://crater:8888/project/Lgc/0.2.0">0.2.0</a></td><td><a href="http://crater:8888/project/Tracker" title="">Tracker</a></td><td></td><td><div title="add support for xhtml -&gt; pdf conversion"><a href="http://crater:8888/ticket/793">T 793</a></div></td><td>livrée</td></tr><tr><td title=""><a href="http://crater:8888/project/Tracker" title="">Tracker</a></td><td><a href="http://crater:8888/project/Tracker/0.1.0">0.1.0</a></td><td><a href="http://crater:8888/project/Tracker/0.2.0">0.2.0</a></td><td><a href="http://crater:8888/project/Confman" title="">Confman</a></td><td><div title="extract core from forge cube"><a href="http://crater:8888/ticket/795">T 795</a></div></td><td></td><td>en cours</td></tr><tr><td title=""><a href="http://crater:8888/project/Confman" title="">Confman</a></td><td><a href="http://crater:8888/project/Confman/0.1.0">0.1.0</a></td><td><a href="http://crater:8888/project/Confman/0.2.0">0.2.0</a></td><td><a href="http://crater:8888/project/Comet" title="">Comet</a></td><td><div title="have a version status sheet"><a href="http://crater:8888/ticket/797">T 797</a></div></td><td></td><td>en cours</td></tr></table></div>
-</div>
-</td>
-</tr></table></div>
-<div class="footer"><a href="http://crater:8888/changelog">nouveautés</a> | <a href="http://crater:8888/doc/about">à propos de ce site</a> | © 2001-2009 <a href="http://www.logilab.fr">Logilab S.A.</a></div></body>
-</html>
\ No newline at end of file
--- a/web/test/unittest_pdf.py	Thu Apr 08 11:04:17 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-import os.path as osp
-from tempfile import NamedTemporaryFile
-from subprocess import Popen as sub
-from xml.etree.cElementTree import ElementTree, fromstring, tostring, dump
-
-from logilab.common.testlib import TestCase, unittest_main
-
-from cubicweb.utils import can_do_pdf_conversion
-from cubicweb.ext.xhtml2fo import ReportTransformer
-
-DATADIR = osp.join(osp.dirname(__file__), 'data')
-
-class PDFTC(TestCase):
-
-    def test_xhtml_to_fop_to_pdf(self):
-        if not can_do_pdf_conversion():
-            self.skip('dependencies not available : check pysixt and fop')
-        xmltree = ElementTree()
-        xmltree.parse(osp.join(DATADIR, 'sample1.xml'))
-        foptree = ReportTransformer(u'contentmain').transform(xmltree)
-        # next
-        foptmp = NamedTemporaryFile()
-        foptree.write(foptmp)
-        foptmp.flush()
-        pdftmp = NamedTemporaryFile()
-        fopproc = sub(['/usr/bin/fop', foptmp.name, pdftmp.name])
-        fopproc.wait()
-        del foptmp
-        if fopproc.returncode:
-            self.skip('fop returned status %s' % fopproc.returncode)
-        pdftmp.seek(0) # a bit superstitious
-        reference = open(osp.join(DATADIR, 'sample1.pdf'), 'r').read()
-        output = pdftmp.read()
-        # XXX almost equals due to ID, creation date, so it seems to fail
-        self.assertEquals( len(output), len(reference) )
-        # cut begin & end 'cause they contain variyng data
-        self.assertTextEquals(output[150:1500], reference[150:1500])
-
-if __name__ == '__main__':
-    unittest_main()
-
--- a/web/views/basecomponents.py	Thu Apr 08 11:04:17 2010 +0200
+++ b/web/views/basecomponents.py	Thu Apr 08 13:38:36 2010 +0200
@@ -2,7 +2,6 @@
 
 * the rql input form
 * the logged user link
-* pdf view link
 
 :organization: Logilab
 :copyright: 2001-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
--- a/web/views/basetemplates.py	Thu Apr 08 11:04:17 2010 +0200
+++ b/web/views/basetemplates.py	Thu Apr 08 13:38:36 2010 +0200
@@ -14,7 +14,7 @@
 from cubicweb.appobject import objectify_selector
 from cubicweb.selectors import match_kwargs
 from cubicweb.view import View, MainTemplate, NOINDEX, NOFOLLOW
-from cubicweb.utils import UStringIO, can_do_pdf_conversion
+from cubicweb.utils import UStringIO
 from cubicweb.schema import display_name
 from cubicweb.web import component, formfields as ff, formwidgets as fw
 from cubicweb.web.views import forms
@@ -268,61 +268,6 @@
             self.w(u'</td>\n')
             self.w(u'</tr></table>\n')
 
-if can_do_pdf_conversion():
-    try:
-        from xml.etree.cElementTree import ElementTree
-    except ImportError: #python2.4
-        from elementtree import ElementTree
-    from subprocess import Popen as sub
-    from StringIO import StringIO
-    from tempfile import NamedTemporaryFile
-    from cubicweb.ext.xhtml2fo import ReportTransformer
-
-
-    class PdfViewComponent(component.EntityVComponent):
-        __regid__ = 'pdfview'
-
-        context = 'ctxtoolbar'
-
-        def cell_call(self, row, col, view):
-            entity = self.cw_rset.get_entity(row, col)
-            url = entity.absolute_url(vid=view.__regid__, __template='pdf-main-template')
-            iconurl = self._cw.build_url('data/pdf_icon.gif')
-            label = self._cw._('Download page as pdf')
-            self.w(u'<a href="%s" title="%s" class="toolbarButton"><img src="%s" alt="%s"/></a>' %
-                   (xml_escape(url), label, xml_escape(iconurl), label))
-
-    class PdfMainTemplate(TheMainTemplate):
-        __regid__ = 'pdf-main-template'
-
-        def call(self, view):
-            """build the standard view, then when it's all done, convert xhtml to pdf
-            """
-            super(PdfMainTemplate, self).call(view)
-            section = self._cw.form.pop('section', 'contentmain')
-            pdf = self.to_pdf(self._stream, section)
-            self._cw.set_content_type('application/pdf', filename='report.pdf')
-            self.binary = True
-            self.w = None
-            self.set_stream()
-            # pylint needs help
-            self.w(pdf)
-
-        def to_pdf(self, stream, section):
-            # XXX see ticket/345282
-            stream = stream.getvalue().replace('&nbsp;', '&#160;').encode('utf-8')
-            xmltree = ElementTree()
-            xmltree.parse(StringIO(stream))
-            foptree = ReportTransformer(section).transform(xmltree)
-            foptmp = NamedTemporaryFile()
-            pdftmp = NamedTemporaryFile()
-            foptree.write(foptmp)
-            foptmp.flush()
-            fopproc = sub(['/usr/bin/fop', foptmp.name, pdftmp.name])
-            fopproc.wait()
-            pdftmp.seek(0)
-            pdf = pdftmp.read()
-            return pdf
 
 # page parts templates ########################################################