summaryrefslogtreecommitdiffstats
path: root/ocrloader.py
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2014-02-24 13:44:41 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2014-02-24 13:44:41 (GMT)
commit2a1ca0a0a4b26a7c3940bcc819a2da5aa4f019aa (patch)
treee228da9192a6427cf3190f7aa25c0bd139e24349 /ocrloader.py
parentbe3c07f6bd1f95f1b49be3e729abcfb52b5098fa (diff)
downloadpfwbged.ocrloader-2a1ca0a0a4b26a7c3940bcc819a2da5aa4f019aa.zip
pfwbged.ocrloader-2a1ca0a0a4b26a7c3940bcc819a2da5aa4f019aa.tar.gz
pfwbged.ocrloader-2a1ca0a0a4b26a7c3940bcc819a2da5aa4f019aa.tar.bz2
use string template for interpolation
Diffstat (limited to 'ocrloader.py')
-rw-r--r--ocrloader.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/ocrloader.py b/ocrloader.py
index 2db6898..26a5a5c 100644
--- a/ocrloader.py
+++ b/ocrloader.py
@@ -9,6 +9,7 @@ import imaplib
import os
import os.path
import requests
+import string
import sys
import tempfile
import time
@@ -53,7 +54,9 @@ def process(cfg, filename, payload, enable_ocr=True):
else:
print ' uploading file'
now = datetime.datetime.now()
- title = cfg.get('title') % {'date': now.strftime('%d/%m/%Y'), 'time': now.strftime('%H:%M')}
+ title = string.Template(cfg.get('title')).substitute(
+ {'date': now.strftime('%d/%m/%Y'),
+ 'time': now.strftime('%H:%M')})
t = os.system('curl -v --insecure -X POST '\
'--form "form.widgets.file=@%s;filename=%s;type=application/pdf" '\
'-F "form.buttons.import=Import" '\