From 25649bc8c9e7bb78d515daf48ece2627bdc801e8 Mon Sep 17 00:00:00 2001
From: Kevin Deldycke <kevin@nexedi.com>
Date: Wed, 25 Jan 2006 11:53:15 +0000
Subject: [PATCH] pdftk-emulation no longer needed with recent version of zope
 and python.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5300 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Form/PDFForm.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/product/ERP5Form/PDFForm.py b/product/ERP5Form/PDFForm.py
index 47bf391230..bbe84f3d20 100755
--- a/product/ERP5Form/PDFForm.py
+++ b/product/ERP5Form/PDFForm.py
@@ -54,6 +54,19 @@ except ImportError:
 # pdftk-emulation available from nexedi's RPM repositories.
 PDFTK_EXECUTABLE = "pdftk-emulation"
 
+# With python >= 2.4 and zope >= 2.7.8, pdftk-emulation is no longer needed
+import sys, App.version_txt
+python_version = sys.version.split(' ')[0].split('.')
+python_version = int(python_version[0]) * 100 +\
+                 int(python_version[1])
+zope_version = App.version_txt.getZopeVersion()
+zope_version = int(zope_version(0)) * 100 * 100 +\
+               int(zope_version(1)) * 100 +\
+               int(zope_version(2))
+if python_version >= 204 and zope_version >= 20708:
+  PDFTK_EXECUTABLE = "pdftk"
+
+
 class PDFTk :
   """
   A class to wrapp calls to pdftk executable, found at
-- 
2.30.9