- Timestamp:
- 07/05/07 13:33:24 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/email2trac.py.in
r163 r164 378 378 pass 379 379 380 def keywords_to_dict(self, str) 381 """ 382 Transfrom a str of the form [<key>=<value>]+ to dict[<key>] = <value> 383 """ 384 # Skip the last ':' character 385 # 386 fields = string.split(str[:-1], ',') 387 388 result = dict() 389 for field in fields: 390 try: 391 index, value = string.split(field,'=') 392 if value: 393 result[index] = value 394 except ValueError: 395 pass 396 397 return results 398 380 399 def ticket_update(self, m): 381 400 """ … … 391 410 TICKET_RE = re.compile(r""" 392 411 (?P<ticketnr>[#][0-9]+:) 412 |(?P<ticketnr_fields>[#][\d]+\?.*:) 393 413 """, re.VERBOSE) 394 414 … … 399 419 body_text = self.get_body_text(m) 400 420 421 # Must we update ticket fields 422 # 423 if result.group('ticketnr_keywords'): 424 nr, keywords = string.split(result.group('ticketnr_fields'), '?') 425 tkt_fields = self.keywords_to_dict(keywords) 426 else: 427 nr = result.group('ticketnr') 428 401 429 # Strip '#' and ':' from ticket_id 402 430 # 403 ticket_id = result.group('ticketnr') 404 ticket_id = int(ticket_id[1:-1]) 431 ticket_id = int(nr[1:-1]) 405 432 406 433 # Get current time
Note: See TracChangeset
for help on using the changeset viewer.