Finished merge with Trevor branch
authorGianluca Montecchi <gian@grys.it>
Tue, 20 Oct 2009 23:18:40 +0000 (01:18 +0200)
committerGianluca Montecchi <gian@grys.it>
Tue, 20 Oct 2009 23:18:40 +0000 (01:18 +0200)
becommands/comment.py
becommands/html.py
libbe/comment.py
libbe/vcs.py

index 9a614b26916ae6e412bbebb852ab20fc473103eb..950a95a6ba7f967dbe73fdee8e5ef1f1daa56cf0 100644 (file)
@@ -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')
index 31b97a1cea548d721e4671bb4392dbb67ecc3a58..232aa80a24b7d002f0c71f570663ecfda6276d75 100644 (file)
@@ -104,7 +104,6 @@ class HTMLGen (object):
         self.verbose = verbose
         self.title = title
         self.index_header = index_header
-        
         if encoding != None:
             self.encoding = encoding
         else:
@@ -118,13 +117,11 @@ class HTMLGen (object):
         if template != None:
             self._load_user_templates()
 
-
-            
     def run(self, out_dir):
         if self.verbose == True:
             print "Creating the html output in %s using templates in %s" \
                 % (out_dir, self.template)
-        
+
         bugs_active = []
         bugs_inactive = []
         bugs = [b for b in self.bd]
@@ -281,7 +278,6 @@ class HTMLGen (object):
             filename = "index_inactive.html"
         else:
             raise Exception, "Unrecognized bug_type: '%s'" % bug_type
-        
         template_info = {'title':title,
                          'index_header':index_header,
                          'charset':self.encoding,
index 41bc7e6c1ea629277e8836186ad570ab676ea22a..02bcc9353f73cb3511f4fd034daad09eb8a94b54 100644 (file)
@@ -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:
index 7b506e8dac3043aef0a58a26e5512b8c7d59e0fa..74846608a5eb47de9f3818bbf6b87567d0a2dcd3 100644 (file)
@@ -840,7 +840,6 @@ class VCS_commit_TestCase(VCSTestCase):
 
     def test_revision_file_contents_as_committed(self):
         """Should get file contents as committed to specified revision."""
-        import sys
         if not self.vcs.versioned:
             return
         for path in self.test_files: