Ticket #36: email2trac.0.13.diff

File email2trac.0.13.diff, 1.1 KB (added by andrei2102@…, 16 years ago)

patch against the latest release

  • ./email2trac.py

    old new  
    100100    SYSLOG_AVAILABLE = False
    101101
    102102from datetime import tzinfo, timedelta, datetime
    103 
     103from trac import config as trac_config
    104104
    105105# Some global variables
    106106#
     
    10231023                print 'File %s does not exist' %file
    10241024                sys.exit(1)
    10251025
    1026         config = ConfigParser.ConfigParser()
    1027         try:
    1028                 config.read(file)
    1029         except ConfigParser.MissingSectionHeaderError,detail:
    1030                 print detail
    1031                 sys.exit(1)
    1032 
     1026        config = trac_config.Configuration(file)
    10331027
    10341028        # Use given project name else use defaults
    10351029        #
    10361030        if name:
    1037                 if not config.has_section(name):
     1031                sections = config.sections()
     1032                if not name in sections:
    10381033                        print "Not a valid project name: %s" %name
    1039                         print "Valid names: %s" %config.sections()
     1034                        print "Valid names: %s" %sections
    10401035                        sys.exit(1)
    10411036
    10421037                project =  dict()
    1043                 for option in  config.options(name):
    1044                         project[option] = config.get(name, option)
     1038                for option, value in  config.options(name):
     1039                        project[option] = value
    10451040
    10461041        else:
    10471042                project = config.defaults()