parent
0a4f779fa4
commit
4294c2b4a1
|
@ -1,16 +1,13 @@
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
|
||||||
|
from calebasse import settings
|
||||||
|
|
||||||
class PdfTk(object):
|
class PdfTk(object):
|
||||||
def __init__(self, pdftk_path=None, prefix='tmp'):
|
def __init__(self, prefix='tmp'):
|
||||||
self._pdftk_path = pdftk_path
|
self.pdftk_path = settings.PDFTK_PATH
|
||||||
self.prefix = prefix
|
self.prefix = prefix
|
||||||
|
|
||||||
@property
|
|
||||||
def pdftk_path(self):
|
|
||||||
return self._pdftk_path or '/usr/bin/pdftk'
|
|
||||||
|
|
||||||
def do(self, args, wait=True):
|
def do(self, args, wait=True):
|
||||||
args = [self.pdftk_path] + args
|
args = [self.pdftk_path] + args
|
||||||
proc = subprocess.Popen(args)
|
proc = subprocess.Popen(args)
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
# Django settings for calebasse project.
|
# Django settings for calebasse project.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from logging.handlers import SysLogHandler
|
from logging.handlers import SysLogHandler
|
||||||
|
|
||||||
PROJECT_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'calebasse')
|
PROJECT_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'calebasse')
|
||||||
|
@ -305,6 +306,9 @@ SERVICE_SETTINGS = {}
|
||||||
# - age_format: string, string (default: None, alternative behaviour to have
|
# - age_format: string, string (default: None, alternative behaviour to have
|
||||||
# age always displayed in months: "months_only")
|
# age always displayed in months: "months_only")
|
||||||
|
|
||||||
|
# Pdftk binary path (pdftk is used to complete CERFA)
|
||||||
|
PDFTK_PATH = '/usr/bin/pdftk'
|
||||||
|
|
||||||
|
|
||||||
#CSV_ENCODING = 'cp1252' #For windows : windows-1252/Winlatin1
|
#CSV_ENCODING = 'cp1252' #For windows : windows-1252/Winlatin1
|
||||||
#CSVPROFILE = {\
|
#CSVPROFILE = {\
|
||||||
|
@ -353,6 +357,9 @@ except ImportError:
|
||||||
import sys
|
import sys
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
if not os.path.exists(PDFTK_PATH):
|
||||||
|
raise ImproperlyConfigured("pdftk %r binary not found" % PDFTK_PATH)
|
||||||
|
|
||||||
if RAVEN_CONFIG:
|
if RAVEN_CONFIG:
|
||||||
INSTALLED_APPS += ('raven.contrib.django.raven_compat', )
|
INSTALLED_APPS += ('raven.contrib.django.raven_compat', )
|
||||||
LOGGING['handlers']['sentry'] = {
|
LOGGING['handlers']['sentry'] = {
|
||||||
|
|
|
@ -19,5 +19,6 @@ raven >= 3.5.2, < 3.6
|
||||||
M2Crypto
|
M2Crypto
|
||||||
--allow-external pycairo
|
--allow-external pycairo
|
||||||
django_select2 < 4.3
|
django_select2 < 4.3
|
||||||
#PyGTK doesn't work with pip
|
|
||||||
django-journal
|
django-journal
|
||||||
|
#PyGTK doesn't work with pip
|
||||||
|
#pdftk we need the binary
|
||||||
|
|
Reference in New Issue