From fa63247f5fc1ff5e7a291e85a8e7959c8d8a1027 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Sat, 11 Apr 2015 22:07:30 -0700 Subject: [PATCH] Fixed edit(). --- rtv/page.py | 6 +++--- rtv/submission.py | 2 +- rtv/subreddit.py | 7 +++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/rtv/page.py b/rtv/page.py index f76b638..8670982 100644 --- a/rtv/page.py +++ b/rtv/page.py @@ -274,7 +274,7 @@ class BasePage(object): prompt = 'Are you sure you want to delete this? (y/n):' char = prompt_input(self.stdscr, prompt) if char != 'y': - show_notification(self.stdscr, ['Canceled']) + show_notification(self.stdscr, ['Aborted']) return with self.safe_call(): @@ -313,12 +313,12 @@ class BasePage(object): text = open_editor(info) curses.doupdate() if text == content: - show_notification(self.stdscr, ['Canceled']) + show_notification(self.stdscr, ['Aborted']) return with self.safe_call(): with self.loader(message='Editing', delay=0): - data['object'].edit() + data['object'].edit(text) time.sleep(2.0) self.refresh_content() diff --git a/rtv/submission.py b/rtv/submission.py index 15f33da..81fa892 100644 --- a/rtv/submission.py +++ b/rtv/submission.py @@ -112,7 +112,7 @@ class SubmissionPage(BasePage): comment_text = open_editor(comment_info) curses.doupdate() if not comment_text: - show_notification(self.stdscr, ['Canceled']) + show_notification(self.stdscr, ['Aborted']) return with self.safe_call(): diff --git a/rtv/subreddit.py b/rtv/subreddit.py index 8945248..1001c0a 100644 --- a/rtv/subreddit.py +++ b/rtv/subreddit.py @@ -132,8 +132,11 @@ class SubredditPage(BasePage): curses.doupdate() # Validate the submission content - if not submission_text or '\n' not in submission_text: - show_notification(self.stdscr, ['Canceled']) + if not submission_text: + show_notification(self.stdscr, ['Aborted']) + return + if '\n' not in submission_text: + show_notification(self.stdscr, ['No content']) return title, content = submission_text.split('\n', 1)