| | """wpd to text file converter for Document Library""" |
---|
| | |
---|
| | from os import popen, remove, path |
---|
| | from Globals import package_home |
---|
| | |
---|
| | content_type = 'application/wordperfect' |
---|
| | |
---|
| | content_description = """WordPerfect [<a href="http://www.wordperfect.com" target="_blank">WordPerfect</a>]""" |
---|
| | |
---|
| | catwpd_file = path.join(package_home(globals()), 'catwpd') |
---|
| | # Uses catwpd, found in the wpConverter directory. See wpConverter/README for |
---|
| | # information on installing catwpd |
---|
| | # Requires write access to /tmp |
---|
| | |
---|
| | def convert(documentFile): |
---|
| | """Convert WordPerfect data to raw text""" |
---|
| | |
---|
| | tmp_name = documentFile._writeToTempFile() |
---|
| | text = popen('%s %s ' % (catwpd_file, tmp_name)).read() |
---|
| | remove(tmp_name) |
---|
| | |
---|
| | return text |
---|
| | |
---|
| | |