From 84e59b05ff0a17178da9ecdb6c5d084e48b42763 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 21 Aug 2016 15:27:53 +0200 Subject: =?UTF-8?q?Don=E2=80=99t=20call=20input=20completion()=20functions?= =?UTF-8?q?=20inside=20completion=20methods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use a placeholder object that can run it afterwards, so that we don’t have side effects inside those functions. --- plugins/reminder.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'plugins/reminder.py') diff --git a/plugins/reminder.py b/plugins/reminder.py index a5ab1f00..f8a69f70 100644 --- a/plugins/reminder.py +++ b/plugins/reminder.py @@ -47,10 +47,11 @@ Will remind you to get up every 1 hour 23 minutes. """ +from poezio.core.structs import Completion from poezio.plugin import BasePlugin -import curses -from poezio import common from poezio import timed_events +from poezio import common +import curses class Plugin(BasePlugin): @@ -107,10 +108,10 @@ class Plugin(BasePlugin): if txt.endswith(' '): n += 1 if n == 2: - return the_input.auto_completion(["60", "5m", "15m", "30m", "1h", "10h", "1d"], '') + return Completion(the_input.auto_completion, ["60", "5m", "15m", "30m", "1h", "10h", "1d"], '') def completion_done(self, the_input): - return the_input.auto_completion(["%s" % key for key in self.tasks], '') + return Completion(the_input.auto_completion, ["%s" % key for key in self.tasks], '') def command_done(self, arg="0"): try: -- cgit v1.2.3