Skip to content

Commit

Permalink
Return lists not str for saved search params
Browse files Browse the repository at this point in the history
  • Loading branch information
urschrei committed Jan 1, 2019
1 parent 410dc2b commit 82ed503
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
6 changes: 3 additions & 3 deletions doc/index.rst
Expand Up @@ -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
Expand Down
15 changes: 3 additions & 12 deletions pyzotero/zotero.py
Expand Up @@ -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 """
Expand All @@ -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
Expand Down

0 comments on commit 82ed503

Please sign in to comment.