Changeset 260
- Timestamp:
- 03/25/09 14:37:24 (15 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r259 r260 7 7 Reported by: hju att jochenkuhl dot de 8 8 Author by: Bas van der Vlies 9 10 * added FullBlogPlugin support. So we can update/create the blogs via email, #116 11 Authors: Bas van der Vlies & lucas dot eisenzimmer at t-systems-mms dot com 9 12 10 13 2009-01-30 -
trunk/debian/changelog
r259 r260 6 6 7 7 * implemented workflow for tickets that are reopend, closes #70 8 Reported by: hju at tjochenkuhl dot de8 Reported by: hju at jochenkuhl dot de 9 9 Author by: Bas van der Vlies 10 11 * added FullBlogPlugin support. So we can update/create the blogs 12 via email, #116 13 Authors: Bas van der Vlies & lucas dot eisenzimmer at t-systems-mms dot com 10 14 11 15 -- root <root@subtrac2.rc.sara.nl> Tue, 24 Mar 2009 15:26:08 +0100 -
trunk/email2trac.py.in
r258 r260 600 600 print 'ticket_field\t %s = %s' %(field, ticket[field]) 601 601 602 def ticket_update(self, m, spam):602 def ticket_update(self, m, id, spam): 603 603 """ 604 604 If the current email is a reply to an existing ticket, this function … … 607 607 """ 608 608 if self.DEBUG: 609 print "TD: ticket_update "609 print "TD: ticket_update: %s" %id 610 610 611 611 if not m['Subject']: … … 614 614 subject = self.email_to_unicode(m['Subject']) 615 615 616 # [hic] #1529: Re: LRZ617 # [hic] #1529?owner=bas,priority=medium: Re: LRZ618 #619 TICKET_RE = re.compile(r"""620 (?P<ticketnr>[#][0-9]+:)621 |(?P<ticketnr_fields>[#][\d]+\?.*?:)622 """, re.VERBOSE)623 624 result = TICKET_RE.search(subject)625 if not result:626 return False627 628 616 # Must we update ticket fields 629 617 # 630 618 update_fields = dict() 631 619 try: 632 nr, keywords = string.split(result.group('ticketnr_fields'), '?')620 id, keywords = string.split(id, '?') 633 621 update_fields = self.str_to_dict(keywords) 634 622 635 623 # Strip '#' 636 624 # 637 self.id = int( nr[1:])638 639 except AttributeError:625 self.id = int(id[1:]) 626 627 except ValueError: 640 628 # Strip '#' and ':' 641 629 # 642 nr = result.group('ticketnr') 643 self.id = int(nr[1:-1]) 630 self.id = int(id[1:-1]) 644 631 645 632 … … 856 843 self.notify(tkt, True) 857 844 845 846 def blog(self, id): 847 """ 848 The blog create/update function 849 """ 850 # import the modules 851 # 852 from tracfullblog.core import FullBlogCore 853 from tracfullblog.model import BlogPost, BlogCommen 854 855 # instantiate blog core 856 blog = FullBlogCore(self.env) 857 req = '' 858 859 if id: 860 861 # update blog 862 # 863 comment = BlogComment(self.env, result.group('blog_id')) 864 comment.author = self.author 865 comment.comment = self.get_body_text(m) 866 blog.create_comment(req, comment) 867 868 else: 869 # create blog 870 # 871 import time 872 post = BlogPost(self.env, 'blog_'+time.strftime("%Y%m%d%H%M%S", time.gmtime())) 873 874 #post = BlogPost(self.env, blog._get_default_postname(self.env)) 875 876 post.author = self.author 877 post.title = self.email_to_unicode(m['Subject']) 878 post.body = self.get_body_text(m) 879 880 blog.create_post(req, post, self.author, u'Created by email2trac', False) 881 882 858 883 def parse(self, fp): 859 884 global m … … 911 936 self.notification = 0 912 937 913 # Must we update existing tickets 914 # 915 if self.TICKET_UPDATE > 0: 916 if self.ticket_update(m, spam_msg): 917 return True 918 919 self.new_ticket(m, spam_msg) 938 print self.get_config('components', 'tracext.google.ads.*') 939 940 # Check if FullBlogPlugin is installed 941 # 942 blog_enabled = None 943 if self.get_config('components', 'tracfullblog.*') in ['enabled']: 944 blog_enabled = True 945 946 # Find out if this is a ticket or a blog 947 if not m['Subject']: 948 return False 949 else: 950 subject = self.email_to_unicode(m['Subject']) 951 952 # 953 # [hic] #1529: Re: LRZ 954 # [hic] #1529?owner=bas,priority=medium: Re: LRZ 955 # 956 TICKET_RE = re.compile(r""" 957 (?P<blog>blog:(?P<blog_id>\w*)) 958 |(?P<ticket_id>[#][\d]+:) 959 |(?P<ticket_fields>[#][\d]+\?.*?:) 960 """, re.VERBOSE) 961 962 result = TICKET_RE.search(subject) 963 964 if result: 965 if result.group('blog') and blog_enabled: 966 self.blog(result.group('blog_id')) 967 968 # update ticket + fields 969 # 970 if result.group('ticket_fields') and self.TICKET_UPDATE: 971 self.ticket_update(m, result.group('ticket_fields'), spam_msg) 972 973 # Update ticket 974 # 975 elif result.group('ticket_id') and self.TICKET_UPDATE: 976 self.ticket_update(m, result.group('ticket_id'), spam_msg) 977 978 # Create ticket 979 # 980 else: 981 self.new_ticket(m, spam_msg) 920 982 921 983 def strip_signature(self, text): … … 1483 1545 from trac import config as trac_config 1484 1546 from trac import util 1547 1548 1485 1549 # 1486 1550 # return util.text.to_unicode(str)
Note: See TracChangeset
for help on using the changeset viewer.