diff options
| author | p_christeas <> | 2009-12-02 11:06:57 +0530 |
|---|---|---|
| committer | Harry (Open ERP) <hmo@tinyerp.com> | 2009-12-02 11:06:57 +0530 |
| commit | d5a68a7b692a6fa568c5fcebc580109afb5bb6d4 (patch) | |
| tree | 249998cdec5a69756180eb39f722b0b45d4c46a2 /addons/document/test_cindex.py | |
| parent | 8d0b4a741816302a30efa28442563afefea8b9cd (diff) | |
[IMP]document : get improvement of document from xrg-addons branch who made nice improvement in document
bzr revid: hmo@tinyerp.com-20091202053657-4oflezyhbolu3xvo
Diffstat (limited to 'addons/document/test_cindex.py')
| -rwxr-xr-x | addons/document/test_cindex.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/addons/document/test_cindex.py b/addons/document/test_cindex.py new file mode 100755 index 00000000000..9993ffad425 --- /dev/null +++ b/addons/document/test_cindex.py @@ -0,0 +1,46 @@ +#!/usr/bin/python + +import sys +import os +import glob + +from optparse import OptionParser + +parser = OptionParser() +parser.add_option("-q", "--quiet", + action="store_false", dest="verbose", default=True, + help="don't print status messages to stdout") + +parser.add_option("-C", "--content", + action="store_true", dest="docontent", default=False, + help="Disect content, rather than the file.") + +(options, args) = parser.parse_args() + +import content_index, std_index + +from content_index import cntIndex + +for fname in args: + try: + if options.docontent: + fp = open(fname,'rb') + content = fp.read() + fp.close() + res = cntIndex.doIndex(content,fname,None,None,True) + else: + res = cntIndex.doIndex(None, fname, None, fname,True) + + if res: + print "Result: ", res[0] + print res[1] + else: + print "No result" + except Exception,e: + import traceback,sys + tb_s = reduce(lambda x, y: x+y, traceback.format_exception( sys.exc_type, sys.exc_value, sys.exc_traceback)) + print "Traceback:",tb_s + print "Exception: ",e + + +#eof |
