use string template for interpolation

This commit is contained in:
Frédéric Péters 2014-02-24 14:44:41 +01:00
parent be3c07f6bd
commit 2a1ca0a0a4
1 changed files with 4 additions and 1 deletions

View File

@ -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" '\