From 2a1ca0a0a4b26a7c3940bcc819a2da5aa4f019aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 24 Feb 2014 14:44:41 +0100 Subject: [PATCH] use string template for interpolation --- ocrloader.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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" '\