From: W. Trevor King Date: Tue, 20 Oct 2009 13:30:42 +0000 (-0400) Subject: Pass content_type to Comment.new_reply() to fix error adding non-text/ comments X-Git-Tag: 1.0.0~59^2~86^2~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=501014a3f86bdfb7be7b52c6d1d0eb4fd7a75f02;p=be.git Pass content_type to Comment.new_reply() to fix error adding non-text/ comments --- diff --git a/becommands/comment.py b/becommands/comment.py index 9a614b2..950a95a 100644 --- a/becommands/comment.py +++ b/becommands/comment.py @@ -119,13 +119,11 @@ def execute(args, manipulate_encodings=True): body+='\n' if options.XML == False: - new = parent.new_reply(body=body) + new = parent.new_reply(body=body, content_type=options.content_type) if options.author != None: new.author = options.author if options.alt_id != None: new.alt_id = options.alt_id - if options.content_type != None: - new.content_type = options.content_type else: # import XML comment [list] # read in the comments str_body = body.encode("unicode_escape").replace(r'\n', '\n') diff --git a/libbe/comment.py b/libbe/comment.py index 41bc7e6..02bcc93 100644 --- a/libbe/comment.py +++ b/libbe/comment.py @@ -604,7 +604,7 @@ class Comment(Tree, settings_object.SavedSettingsObject): reply.in_reply_to = self.uuid self.append(reply) - def new_reply(self, body=None): + def new_reply(self, body=None, content_type=None): """ >>> comm = Comment(bug=None, body="Some insightful remarks") >>> repA = comm.new_reply("Critique original comment") @@ -613,6 +613,8 @@ class Comment(Tree, settings_object.SavedSettingsObject): True """ reply = Comment(self.bug, body=body) + if content_type != None: # set before saving body to decide binary format + reply.content_type = content_type if self.bug != None: reply.set_sync_with_disk(self.bug.sync_with_disk) if reply.sync_with_disk == True: