Fix unicode errors on commit
[mw] / src / mw / clicommands.py
index ee863b1cb1b36c3c11170d4a09379d6721396bed..4b4d3e5c79be1fb9d02e61f47b7e1f4a73399f2a 100644 (file)
@@ -221,6 +221,7 @@ class CommitCommand(CommandBase):
                 # FIXME use basetimestamp and starttimestamp
                 filename = os.path.join(self.metadir.root, file)
                 text = codecs.open(filename, 'r', 'utf-8').read()
+                text = text.encode('utf-8')
                 if text[-1] == '\n':
                     text = text[:-1]
                 md5 = hashlib.md5()
@@ -232,6 +233,7 @@ class CommitCommand(CommandBase):
                         'token': edittoken,
                         'text': text,
                         'md5': textmd5,
+                        'summary': edit_summary,
                 }
                 response = self.api.call(data)
                 if response['edit']['result'] == 'Success':
@@ -243,7 +245,6 @@ class CommitCommand(CommandBase):
                                     'ids|flags|timestamp|user|comment|content',
                     }
                     response = self.api.call(data)['query']['pages']
-                    print response
                     self.metadir.pages_add_rv(int(pageid),
                                               response[pageid]['revisions'][0])
                 else:

Benjamin Mako Hill || Want to submit a patch?