X-Git-Url: https://projects.mako.cc/source/mw/blobdiff_plain/c846c000883d4eebd1d4135dac6a379faf7484c7..fc69b26dbca870828cb1e5fe4e580532a39540b7:/src/mw/clicommands.py diff --git a/src/mw/clicommands.py b/src/mw/clicommands.py index c180c6a..9360822 100644 --- a/src/mw/clicommands.py +++ b/src/mw/clicommands.py @@ -48,6 +48,11 @@ class CommandBase(object): def _login(self): user = raw_input('Username: ') passwd = getpass.getpass() + result = self.api.call({'action': 'login', + 'lgname': user, + 'lgpassword': passwd}) + if result['login']['result'] != 'Success': + raise Exception('Login error: %s' % result['login']['result']) def _die_if_no_init(self): if self.metadir.config is None: @@ -96,8 +101,9 @@ class PullCommand(CommandBase): print '%s: %s: page does not exist, file not created' % \ (self.me, pagename) continue - revid = [x['revid'] for x in response[pageid]['revisions']] - self.metadir.pagedict_add(pagename, int(pageid)) + revids = [x['revid'] for x in response[pageid]['revisions']] + revids.sort() + self.metadir.pagedict_add(pagename, pageid, revids[-1]) self.metadir.pages_add_rv(int(pageid), response[pageid]['revisions'][0]) filename = mw.api.pagename_to_filename(pagename)