Changeset 165 for trunk


Ignore:
Timestamp:
07/05/07 17:39:13 (17 years ago)
Author:
bas
Message:

email2trac.py.in:

  • Working ticket field manipulation with mail. Basic we do not check if ticket fields exists or if the values are correct, ticket #7
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/email2trac.py.in

    r164 r165  
    378378                        pass
    379379
    380         def keywords_to_dict(self, str)
     380        def keywords_to_dict(self, str):
    381381                """
    382382                Transfrom a str of the form [<key>=<value>]+ to dict[<key>] = <value>
     
    391391                                index, value = string.split(field,'=')
    392392                                if value:
    393                                         result[index] = value
     393                                        result[index.lower()] = value
    394394                        except ValueError:
    395395                                pass
    396396
    397                 return results
     397                return result
    398398                               
    399399        def ticket_update(self, m):
     
    421421                # Must we update ticket fields
    422422                #
    423                 if result.group('ticketnr_keywords'):
     423                try:
    424424                        nr, keywords = string.split(result.group('ticketnr_fields'), '?')
    425425                        tkt_fields = self.keywords_to_dict(keywords)
    426                 else:
     426
     427                        # Strip '#'
     428                        #
     429                        ticket_id = int(nr[1:])
     430
     431                except AttributeError:
     432                        tkt_fields = dict()
     433
    427434                        nr = result.group('ticketnr')
    428 
    429                 # Strip '#' and ':' from ticket_id
    430                 #
    431                 ticket_id = int(nr[1:-1])
     435                        # Strip '#' and ':'
     436                        #
     437                        ticket_id = int(nr[1:-1])
     438
    432439
    433440                # Get current time
     
    443450                        except util.TracError, detail:
    444451                                return False
     452
     453                        # Must we update some ticket fields
     454                        #
     455                        #for entry in tkt.fields:
     456                        #       print entry['name']
     457                        #       print entry
     458                        #sys.exit(1)
     459                        for key,value in tkt_fields.items():
     460                                tkt[key] = value
    445461
    446462                        tkt.save_changes(self.author, body_text, when)
Note: See TracChangeset for help on using the changeset viewer.