summaryrefslogtreecommitdiff
path: root/addons/document/std_index.py
diff options
context:
space:
mode:
authoruco (OpenERP) <uco@tinyerp.com>2010-12-06 18:41:02 +0530
committeruco (OpenERP) <uco@tinyerp.com>2010-12-06 18:41:02 +0530
commitb1cf433ecc01a58c8abe27fdf9dbaba2deedf7f5 (patch)
tree7d4b2df75b76c3529854cf98c401ad59370ce00a /addons/document/std_index.py
parenteb04af83f31615e220a1b5e9639e799eb88242d6 (diff)
parent5350ab0c1930e6573ee52bd430bb1d0f5adea2a3 (diff)
[MERGE]: Merged with trunk-addons.
bzr revid: uco@tinyerp.com-20101206131102-z2xzz8eshkswo00q
Diffstat (limited to 'addons/document/std_index.py')
-rw-r--r--addons/document/std_index.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/addons/document/std_index.py b/addons/document/std_index.py
index 2a588a017c1..7cfcd36e2dc 100644
--- a/addons/document/std_index.py
+++ b/addons/document/std_index.py
@@ -96,8 +96,13 @@ class DocIndex(indexer):
def _doIndexFile(self,fname):
fp = Popen(['antiword', fname], shell=False, stdout=PIPE).stdout
- return _to_unicode(fp.read())
-
+ try:
+ file_data = _to_unicode(fp.read())
+ finally:
+ fp.close()
+
+ return file_data
+
cntIndex.register(DocIndex())
class DocxIndex(indexer):
@@ -158,7 +163,12 @@ class PdfIndex(indexer):
def _doIndexFile(self,fname):
fp = Popen(['pdftotext', '-enc', 'UTF-8', '-nopgbrk', fname, '-'], shell=False, stdout=PIPE).stdout
- return _to_unicode( fp.read())
+ try:
+ file_data = _to_unicode( fp.read())
+ finally:
+ fp.close()
+
+ return file_data
cntIndex.register(PdfIndex())