adding -b option for --bot
[mw] / src / mw / clicommands.py
index a42bcfbab0107492d5f2c0b6acfac9d910228dc1..7931ac69e9c5a3ae2504b18cd842c84c944bb9c0 100644 (file)
@@ -58,15 +58,15 @@ class CommandBase(object):
             # cookies are saved to a file
             print 'Login successful! (yay)'
         elif result['login']['result'] == 'NeedToken':
-            print'Login with token'
+            print 'Login with token'
             result = self.api.call({'action': 'login',
-                               'lgname': user,
-                               'lgpassword': passwd,
-                               'lgtoken': result['login']['token']})
+                                    'lgname': user,
+                                    'lgpassword': passwd,
+                                    'lgtoken': result['login']['token']})
             if result['login']['result'] == 'Success':
                 print 'Login successful! (yay)'
-    else:
-        print 'Login failed: %s' % result['login']['result']
+            else:
+                print 'Login failed: %s' % result['login']['result']
         else:
             print 'Login failed: %s' % result['login']['result']
 
@@ -190,7 +190,7 @@ class CommitCommand(CommandBase):
         self.parser.add_option('-m', '--message', dest='edit_summary',
                                help='don\'t prompt for edit summary and '
                                'use this instead')
-        self.parser.add_option('--bot', dest='bot', action='store_true',
+        self.parser.add_option('-b', '--bot', dest='bot', action='store_true',
                                help='mark actions as a bot (won\'t affect '
                                'anything if you don\'t have the bot right',
                                default=False)
@@ -232,7 +232,7 @@ class CommitCommand(CommandBase):
                 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':
+                if (len(text) != 0) and (text[-1] == '\n'):
                     text = text[:-1]
                 md5 = hashlib.md5()
                 md5.update(text)

Benjamin Mako Hill || Want to submit a patch?