Changeset 503
- Timestamp:
- 01/07/11 15:44:00 (13 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r501 r503 10 10 * Support for parentdir. Can be used to avoid sections for each project 11 11 or if all projects have a common parent directory, you can leave out 12 the project drectory setting for each project. 12 the project drectory setting for each project, eg: 13 * parentdir: /data/trac/oss/projects 13 14 14 15 If an section defines a project directory then this can NOT be overriden … … 44 45 * Fixed some bugs in function update_ticket_fields: 45 46 - Can not clear values, repoterd by thomas dot moschny add gmx dot de 46 47 closes #228 47 48 - Values were updated regardless if there are not allowed for the ticket 48 49 field. 49 50 Author: Bas van der Vlies 50 51 … … 60 61 * Added html conversion via external commmand: eg email2trac.conf 61 62 - html2text_cmd: /usr/bin/html2text -nobs 63 - html2text_cmd: /usr/bin/w3m -dump 64 - html2text_cmd: /usr/bin/lynx -dump 65 - html2text_cmd: /usr/bin/links -dump 62 66 closes #218 63 67 Author: Bas van der Vlies … … 75 79 also honour the permission model if set, closes #198 76 80 an example how to use it: 77 81 email2trac.conf: 78 82 [project] 79 80 81 82 83 84 85 86 87 88 89 90 83 workflow_closed: reopen 84 xworkflow_infoneeded: provideinfo 85 86 trac.ini: 87 [ticket-workflow] 88 reopen = closed -> reopened 89 reopen.permissions = TICKET_CREATE 90 reopen.operations = del_resolution 91 92 provideinfo = infoneeded -> moreinfo 93 provideinfo.permissions = TICKET_CREATE 94 provideinfo.name = info provided 91 95 92 96 Authors: kroseneg add schmidham dot net and Bas van der Vlies -
trunk/email2trac.py.in
r502 r503 585 585 self.logger.debug(util.text.unicode_quote(s)) 586 586 587 588 def html_2_txt(self, data): 589 """ 590 Various routines to convert html syntax to valid trac wiki syntax 591 """ 592 self.logger.debug('function html_2_txt') 593 594 ## This routine make an safe html that can be include 595 # in trac, but no further text processing can be done 596 # 597 # try: 598 # from lxml.html.clean import Cleaner 599 # tags_rm = list() 600 # tags_rm.append('body') 601 # 602 # cleaner = Cleaner(remove_tags=tags_rm ) 603 # parsed_data = cleaner.clean_html(data) 604 # parsed_data = '\n{{{\n#!html\n' + parsed_data + '\n}}}\n' 605 # 606 # return parsed_data 607 # 608 # except ImportError:: 609 # pass 610 611 parsed_data = None 612 if self.parameters.html2text_cmd: 613 tmp_file = tempfile.mktemp('email2trac.html') 614 cmd = '%s %s' %(self.parameters.html2text_cmd, tmp_file) 615 self.logger.debug('\t html2text conversion %s'%(cmd)) 616 617 if self.parameters.dry_run: 618 print 'DRY_RUN: html2text conversion command: %s\n' %(cmd) 619 620 else: 621 f = open(tmp_file, "w+") 622 f.write(data) 623 f.close() 624 625 lines = os.popen(cmd).readlines() 626 parsed_data = ''.join(lines) 627 628 os.unlink(tmp_file) 629 630 else: 631 self.logger.debug('\t No html2text conversion tool specified in email2trac.conf') 632 633 return parsed_data 634 587 635 ########## TRAC ticket functions ########################################################### 588 636 … … 1833 1881 if content_type == 'text/html': 1834 1882 1835 if self.parameters.html2text_cmd: 1836 1837 tmp_file = tempfile.mktemp('.email2trac') 1838 cmd = '%s %s' %(self.parameters.html2text_cmd, tmp_file) 1839 self.logger.debug('\t html2text conversion %s'%(cmd)) 1840 1841 if self.parameters.dry_run: 1842 print 'DRY_RUN: html2text conversion command: %s\n' %(cmd) 1843 else: 1844 f = open(tmp_file, "w+") 1845 f.write(body_text) 1846 f.close() 1847 1848 lines = os.popen(cmd).readlines() 1849 body_text = ''.join(lines) 1850 1851 os.unlink(tmp_file) 1852 1853 else: 1854 self.logger.debug('\t No html2text conversion tool specified in email2trac.conf') 1883 body_text = self.html_2_txt(body_text) 1884 if not body_text: 1855 1885 continue 1856 1886
Note: See TracChangeset
for help on using the changeset viewer.