From a8564341884b872b5c02f5f0160ad2f5b05b821d Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Sat, 19 Feb 2011 18:54:01 +0100 Subject: [PATCH] fix the 'log' command --- .../webcontentedit/webcontentedit.py | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/weboob/applications/webcontentedit/webcontentedit.py b/weboob/applications/webcontentedit/webcontentedit.py index b6c47e54..a318d934 100644 --- a/weboob/applications/webcontentedit/webcontentedit.py +++ b/weboob/applications/webcontentedit/webcontentedit.py @@ -41,7 +41,7 @@ class WebContentEdit(ReplApplication): def do_edit(self, line): """ - edit ID + edit ID [ID...] Edit a content with $EDITOR, then push it on the website. """ @@ -66,7 +66,7 @@ class WebContentEdit(ReplApplication): data = content.content if isinstance(data, unicode): data = data.encode('utf-8') - f.write(data) + f.write(data or '') paths[path] = content params = '' @@ -115,10 +115,18 @@ class WebContentEdit(ReplApplication): raise errors def do_log(self, line): - for id in line.split(): - _id, backend_name = self.parse_id(id) - backend_names = (backend_name,) if backend_name is not None else self.enabled_backends + """ + log ID + + Display log of a page + """ + if not line: + print >>sys.stderr, 'Error: please give a page ID' + return 1 + + _id, backend_name = self.parse_id(line) + backend_names = (backend_name,) if backend_name is not None else self.enabled_backends _id = _id.encode('utf-8') - for backend, revision in self.do('iter_revisions', _id, max_results=self.options.count): + for backend, revision in self.do('iter_revisions', _id, max_results=self.options.count, backends=backend_names): self.format(revision)