Ticket #235: blog_subject.patch

File blog_subject.patch, 2.1 KB (added by thomas.moschny@…, 11 years ago)
  • ./email2trac.py.in

    diff -up ./email2trac.py.in.orig ./email2trac.py
    old new class TicketEmailParser(object): 
    13471347
    13481348########## Fullblog functions  #################################################
    13491349
    1350     def blog(self, id):
     1350    def blog(self, msg, subject, id):
    13511351        """
    13521352        The blog create/update function
    13531353        """
    class TicketEmailParser(object): 
    13681368            comment = BlogComment(self.env, id)
    13691369            comment.author = self.author
    13701370
    1371             message_parts = self.get_message_parts(m)
     1371            message_parts = self.get_message_parts(msg)
    13721372            comment.comment = self.get_body_text(message_parts)
    13731373
     1374            if self.parameters.dry_run:
     1375                self.logger.info('DRY-RUN: not adding comment for blog entry "%s"' % id)
     1376                return
    13741377            blog.create_comment(req, comment)
    13751378
    13761379        else:
    class TicketEmailParser(object): 
    13821385            #post = BlogPost(self.env, blog._get_default_postname(self.env))
    13831386           
    13841387            post.author = self.author
    1385             post.title = self.email_to_unicode(m['Subject'])
     1388            post.title = subject.strip()
    13861389
    1387             message_parts = self.get_message_parts(m)
     1390            message_parts = self.get_message_parts(msg)
    13881391            post.body = self.get_body_text(message_parts)
    13891392           
     1393            if self.parameters.dry_run:
     1394                self.logger.info('DRY-RUN: not creating blog entry "%s"' % post.title)
     1395                return
    13901396            blog.create_post(req, post, self.author, u'Created by email2trac', False)
    13911397
    13921398
    class TicketEmailParser(object): 
    17231729            if blog_enabled:
    17241730                if result.group('blog'):
    17251731                    self.system = 'blog'
    1726                     self.blog(result.group('blog_id'))
     1732                    self.blog(m, subject[result.end('blog'):], result.group('blog_id'))
    17271733
    17281734            if discussion_enabled:
    17291735                ## New topic.