Changeset 169
- Timestamp:
- 07/06/07 09:56:11 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/email2trac.py.in
r167 r169 390 390 try: 391 391 index, value = string.split(field,'=') 392 393 # We can not change the description of a ticket via the subject 394 # line. The description is the body of the email 395 # 396 if index.lower() in ['description']: 397 continue 398 392 399 if value: 393 400 result[index.lower()] = value 401 394 402 except ValueError: 395 403 pass … … 397 405 return result 398 406 399 def update_ticket_fields(self, system_fields, user_fields): 400 for field in system_fields: 401 print field['name'] 407 def update_ticket_fields(self, ticket, user_dict): 408 """ 409 This will update the ticket fields when supplied via 410 the subject mail line. It will only update the ticket 411 field: 412 - If the field is known 413 - If the value supplied is valid for the ticket field 414 - Else we skip it and no error is given 415 """ 416 417 # Build a system dictionary from the ticket fields 418 # with field as index and option as value 419 # 420 sys_dict = dict() 421 for field in ticket.fields: 402 422 try: 403 print field['options'] 423 sys_dict[field['name']] = field['options'] 424 404 425 except KeyError: 405 print field426 sys_dict[field['name']] = None 406 427 pass 428 429 # Check user supplied fields an compare them with the 430 # system one's 431 # 432 for field,value in user_dict.items(): 433 if self.DEBUG >= 5: 434 print 'user field : %s=%s' %(field,value) 435 436 if sys_dict.has_key(field): 437 if self.DEBUG >= 5: 438 print 'sys field : ', sys_dict[field] 439 440 # Check if value is an allowed system option, if TypeError then 441 # every value is allowed 442 # 443 try: 444 if value in sys_dict[field]: 445 ticket[field] = value 446 447 except TypeError: 448 ticket[field] = value 449 450 407 451 408 452 def ticket_update(self, m): … … 459 503 return False 460 504 461 # Must we update some ticket fields 462 # 463 self.update_ticket_fields(tkt.fields, update_tkt_fields) 464 sys.exit(1) 465 466 for key,value in tkt_fields.items(): 467 tkt[key] = value 505 # Must we update some ticket fields properties 506 # 507 self.update_ticket_fields(tkt, update_tkt_fields) 468 508 469 509 tkt.save_changes(self.author, body_text, when)
Note: See TracChangeset
for help on using the changeset viewer.