Changeset 545 for trunk/email2trac.py.in
- Timestamp:
- 08/10/11 12:18:09 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/email2trac.py.in
r543 r545 645 645 ########## TRAC ticket functions ########################################################### 646 646 647 def email2trac_workflow(self, tkt): 648 """ 649 """ 650 self.logger.debug('function email2trac_workflow: ') 651 652 req = Mock(authname=self.author, perm=MockPerm(), args={}) 653 ticket_system = TicketSystem(self.env) 654 655 try: 656 workflow = self.parameters['workflow_%s' %tkt['status'].lower()] 657 658 except KeyError: 659 ## 660 # fallback for compability (Will be deprecated) 661 # workflow can be none. 662 # 663 workflow = None 664 if tkt['status'] in ['closed']: 665 workflow = self.parameters.workflow 666 667 if workflow: 668 669 ## There can be several workflow implementations 670 # 671 for controller in ticket_system.action_controllers: 672 673 ## Not Needed anymore, 9 Aug 2011 BvdV, we already checked the permissions 674 # 675 #if self.parameters.ticket_permission_system: 676 # 677 # 678 # try: 679 # if not self.check_permission(tkt, controller.actions[workflow]['permissions'][0]): 680 # self.logger.info('Reporter: %s has no permission to trigger workflow' %self.author) 681 # break 682 # except AttributeError, detail: 683 # self.logger.info('controller %s has no actions implementations' %(controller)) 684 # 685 686 fields = controller.get_ticket_changes(req, tkt, workflow) 687 for key in fields.keys(): 688 self.logger.debug('\t workflow %s %s : %s' %(controller, key, fields[key])) 689 tkt[key] = fields[key] 690 691 return True 692 693 else: 694 return False 695 647 696 def check_permission_participants(self, tkt, action): 648 697 """ … … 860 909 # 861 910 if self.parameters.email_triggers_workflow and (self.VERSION >= 0.11): 862 self.logger.debug('Workflow ticket update fields: ') 863 864 req = Mock(authname=self.author, perm=MockPerm(), args={}) 865 ticket_system = TicketSystem(self.env) 866 867 try: 868 workflow = self.parameters['workflow_%s' %tkt['status'].lower()] 869 870 except KeyError: 871 ## 872 # fallback for compability (Will be deprecated) 873 # workflow can be none. 874 # 875 workflow = None 876 if tkt['status'] in ['closed']: 877 workflow = self.parameters.workflow 878 879 if workflow: 880 881 ## There can be several workflow implementations 882 # 883 for controller in ticket_system.action_controllers: 884 885 ## Not Needed anymore, 9 Aug 2011 BvdV, we already checked the permissions 886 # 887 #if self.parameters.ticket_permission_system: 888 # 889 # 890 # try: 891 # if not self.check_permission(tkt, controller.actions[workflow]['permissions'][0]): 892 # self.logger.info('Reporter: %s has no permission to trigger workflow' %self.author) 893 # break 894 # except AttributeError, detail: 895 # self.logger.info('controller %s has no actions implementations' %(controller)) 896 # 897 898 fields = controller.get_ticket_changes(req, tkt, workflow) 899 900 for key in fields.keys(): 901 self.logger.debug('\t workflow %s %s : %s' %(controller, key, fields[key])) 902 tkt[key] = fields[key] 903 904 else: 911 912 if not self.email2trac_workflow(tkt): 905 913 906 914 if tkt['status'] in ['closed']: … … 1188 1196 comment = '%s\n%s\n' %(comment, error_with_attachments) 1189 1197 1198 if self.parameters.email_triggers_workflow and (self.VERSION >= 0.11): 1199 if self.email2trac_workflow(tkt): 1200 changed = True 1201 1190 1202 if changed: 1191 1203 if self.parameters.dry_run: … … 1196 1208 1197 1209 if not spam: 1198 self.notify(tkt, True) 1210 self.notify(tkt, True) 1199 1211 1200 1212
Note: See TracChangeset
for help on using the changeset viewer.