From 82ed5030e8495a1c0ff2567c509bc21514cd0a2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20H=C3=BCgel?= Date: Tue, 1 Jan 2019 13:31:19 +0000 Subject: [PATCH] Return lists not str for saved search params --- doc/index.rst | 6 +++--- pyzotero/zotero.py | 15 +++------------ 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/doc/index.rst b/doc/index.rst index 15e149b..2572f2a 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -778,20 +778,20 @@ Pyzotero allows you to retrieve, delete, or modify saved searches: Show available saved search operators - :rtype: str + :rtype: list .. py:method:: Zotero.show_conditions() Show available saved search conditions - :rtype: str + :rtype: list .. py:method:: Zotero.show_condition_operators(condition) Show available operators for a given saved search condition :param str condition: a valid saved search condition - :rtype: str + :rtype: list ================= Item Methods diff --git a/pyzotero/zotero.py b/pyzotero/zotero.py index af2b25c..91c1c15 100644 --- a/pyzotero/zotero.py +++ b/pyzotero/zotero.py @@ -922,19 +922,13 @@ def show_operators(self): """ Show available saved search operators """ if not self.savedsearch: self.savedsearch = SavedSearch(self) - print( - "Available saved search operators: %s" - % ", ".join(self.savedsearch.operators) - ) + return self.savedsearch.operators def show_conditions(self): """ Show available saved search conditions """ if not self.savedsearch: self.savedsearch = SavedSearch(self) - print( - "Available saved search conditions: %s" - % ", ".join(self.savedsearch.conditions_operators.keys()) - ) + return self.savedsearch.conditions_operators.keys() def show_condition_operators(self, condition): """ Show available operators for a given saved search condition """ @@ -946,10 +940,7 @@ def show_condition_operators(self, condition): permitted_operators_list = set( [self.savedsearch.operators.get(op) for op in permitted_operators] ) - print( - "Available saved search operators for '%s': %s" - % (condition, ", ".join(permitted_operators_list)) - ) + return permitted_operators_list def saved_search(self, name, conditions): """ Create a saved search. conditions is a list of dicts