Fix unicode errors on commit
authorIan Weller <ian@ianweller.org>
Sun, 14 Mar 2010 17:56:04 +0000 (12:56 -0500)
committerIan Weller <ian@ianweller.org>
Sun, 14 Mar 2010 17:56:04 +0000 (12:56 -0500)
src/mw/clicommands.py

index 92a852c9e2dd6684bb2d8347899814bc4bd1295d..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()
                 # 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()
                 if text[-1] == '\n':
                     text = text[:-1]
                 md5 = hashlib.md5()
@@ -244,7 +245,6 @@ class CommitCommand(CommandBase):
                                     'ids|flags|timestamp|user|comment|content',
                     }
                     response = self.api.call(data)['query']['pages']
                                     '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:
                     self.metadir.pages_add_rv(int(pageid),
                                               response[pageid]['revisions'][0])
                 else:

Benjamin Mako Hill || Want to submit a patch?