Changeset 87
- Timestamp:
- 06/22/06 14:13:42 (17 years ago)
- Location:
- emailtotracscript/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
emailtotracscript/trunk/ChangeLog
r85 r87 3 3 the database connection. 4 4 Fixed by: Walter de Jong en Bas van der Vlies 5 6 - Added enable_syslog option. If enabled log errors 7 to syslog instead of stderr. If enabled no errors are 8 send back to the user. 9 Implemented by: Bas van der Vlies 10 11 - Fixed an error with updating tickets with attachments for trac 12 versions 0.9 and 0.10. Field "id" is not known when a existing 13 ticket is fetched (Error = KeyError: 'id') 14 Fixed By: See tickets #258 and #449 on trac-hacks 5 15 6 16 2006-06-02 -
emailtotracscript/trunk/INSTALL
r82 r87 22 22 email_header: 1 # OPTIONAL, if set then show TO/CC fields in description 23 23 trac_version: 0.8 # OPTIONAL, if set use this as trac version (D: 0.9) 24 enable_syslog: 1 # OPTIONAL, if set log errors to syslog 24 25 25 26 [bas] # OPTIONAL project declaration, also set -
emailtotracscript/trunk/debian/changelog
r85 r87 1 email2trac (0.7.3-1) stable; urgency=low 2 3 * Enabled syslog option 4 5 -- root <root@subtrac.sara.nl> Thu, 22 Jun 2006 12:45:37 +0200 6 7 email2trac (0.7.2-0) stable; urgency=low 8 9 * Added new try/except statement and fixed LookupError 10 11 -- root <root@subtrac.sara.nl> Thu, 22 Jun 2006 09:59:02 +0200 12 1 13 email2trac (0.7.1-3) stable; urgency=low 2 14 -
emailtotracscript/trunk/email2trac.conf
r43 r87 11 11 email_header: 1 12 12 trac_version: 0.9 13 enable_syslog : 0 13 14 alternate_notify_template : 15 14 16 15 17 [bas] -
emailtotracscript/trunk/email2trac.py.in
r86 r87 54 54 spam_level : 4 # OPTIONAL, if set check for SPAM mail 55 55 reply_address: 1 # OPTIONAL, if set then fill in ticket CC field 56 56 umask : 022 # OPTIONAL, if set then use this umask for creation of the attachments 57 57 mailto_link : 1 # OPTIONAL, if set then [mailto:<>] in description 58 58 mailto_cc : basv@sara.nl # OPTIONAL, use this address as CC in mailto line … … 187 187 try: 188 188 temp = unicode(text, format) 189 except UnicodeError:189 except (UnicodeError,LookupError): 190 190 # This always works 191 191 # 192 192 temp = unicode(text, 'iso-8859-15') 193 193 194 temp = temp.encode('utf-8') 194 195 else: … … 495 496 # UTF-8 encode body_text 496 497 # 497 charset = msg.get_content_charset('iso-8859-15')498 charset = part.get_content_charset('iso-8859-15') 498 499 ubody_text = unicode(body_text, charset).encode('utf-8') 499 500 … … 696 697 return project 697 698 699 698 700 if __name__ == '__main__': 699 701 # Default config file … … 702 704 project = '' 703 705 component = '' 704 706 ENABLE_SYSLOG = 0 707 705 708 try: 706 709 opts, args = getopt.getopt(sys.argv[1:], 'chf:p:', ['component=','help', 'file=', 'project=']) … … 709 712 print detail 710 713 sys.exit(1) 711 714 712 715 project_name = None 713 716 for opt,value in opts: … … 721 724 elif opt in ['-p', '--project']: 722 725 project_name = value 723 726 724 727 settings = ReadConfig(configfile, project_name) 725 728 if not settings.has_key('project'): … … 727 730 print 'No Trac project is defined in the email2trac config file.' 728 731 sys.exit(1) 729 732 730 733 if component: 731 734 settings['component'] = component 732 735 733 736 if settings.has_key('trac_version'): 734 737 version = float(settings['trac_version']) … … 736 739 version = trac_default_version 737 740 741 if settings.has_key('enable_syslog'): 742 ENABLE_SYSLOG = float(settings['enable_syslog']) 743 738 744 #debug HvB 739 745 #print settings 740 741 if version == 0.8: 742 from trac.Environment import Environment 743 from trac.Ticket import Ticket 744 from trac.Notify import TicketNotifyEmail 745 from trac.Href import Href 746 from trac import util 747 import sqlite 748 elif version == 0.9: 749 from trac import attachment 750 from trac.env import Environment 751 from trac.ticket import Ticket 752 from trac.web.href import Href 753 from trac import util 754 from trac.Notify import TicketNotifyEmail 755 elif version == 0.10: 756 from trac import attachment 757 from trac.env import Environment 758 from trac.ticket import Ticket 759 from trac.web.href import Href 760 from trac import util 761 # see http://projects.edgewall.com/trac/changeset/2799 762 from trac.ticket.notification import TicketNotifyEmail 763 764 env = Environment(settings['project'], create=0) 765 tktparser = TicketEmailParser(env, settings, version) 766 tktparser.parse(sys.stdin) 746 747 try: 748 if version == 0.8: 749 from trac.Environment import Environment 750 from trac.Ticket import Ticket 751 from trac.Notify import TicketNotifyEmail 752 from trac.Href import Href 753 from trac import util 754 import sqlite 755 elif version == 0.9: 756 from trac import attachment 757 from trac.env import Environment 758 from trac.ticket import Ticket 759 from trac.web.href import Href 760 from trac import util 761 from trac.Notify import TicketNotifyEmail 762 elif version == 0.10: 763 from trac import attachment 764 from trac.env import Environment 765 from trac.ticket import Ticket 766 from trac.web.href import Href 767 from trac import util 768 # see http://projects.edgewall.com/trac/changeset/2799 769 from trac.ticket.notification import TicketNotifyEmail 770 771 env = Environment(settings['project'], create=0) 772 tktparser = TicketEmailParser(env, settings, version) 773 tktparser.parse(sys.stdin) 774 775 # Catch all errors ans log to SYSLOG if we have enabled this 776 # else stdout 777 # 778 except Exception, error: 779 import syslog, traceback 780 781 if ENABLE_SYSLOG: 782 syslog.openlog('email2trac', syslog.LOG_NOWAIT) 783 etype, evalue, etb = sys.exc_info() 784 for e in traceback.format_exception(etype, evalue, etb): 785 syslog.syslog(e) 786 syslog.closelog() 787 else: 788 traceback.print_exc() 767 789 768 790 # EOB
Note: See TracChangeset
for help on using the changeset viewer.