Commit be8f5439 authored by ryanss's avatar ryanss
Browse files

Add optional named arguments to set_entries_list

parent b4785401
......@@ -132,19 +132,21 @@ get_entries_count(query_object, deleted=False)
# Get a count of all Contacts with a first name of "Fred"
# and include Contacts that have been deleted
cq = sugarcrm.Contact(first_name="Fred")
contacts = sugar.get_entries_count(cq, deleted=True)
contact_query = sugarcrm.Contact(first_name="Fred")
contacts = sugar.get_entries_count(contact_query, deleted=True)
for contact in contacts:
print contact.first_name, contact.last_name
get_entry_list(query_object, field_list=[], order_by="",
max_results=0, offset=0,
deleted=False, favorites=False)
Retrieves a list of objects based on query specifications.
.. code-block:: python
# Get a list of all Notes with a name that begins with "Test"
nq = sugarcrm.Note(name="Test%")
notes = sugar.get_entry_list(nq)
note_query = sugarcrm.Note(name="Test%")
notes = sugar.get_entry_list(note_query)
for note in notes:
......@@ -88,11 +88,14 @@ class API:
def get_entries_count(self, q, deleted=False):
"""Retrieves a count of beans based on query specifications."""
data = [self.session_id, q.module, q.query, int(deleted)]
return self._request('get_entries_count', data)['result_count']
return int(self._request('get_entries_count', data)['result_count'])
def get_entry_list(self, q):
def get_entry_list(self, q, fields=(), order_by="",
max_results=0, offset=0,
deleted=False, favorites=False):
"""Retrieves a list of objects based on query specifications."""
data = [self.session_id, q.module, q.query, "", 0, [], [], 0, 0, False]
data = [self.session_id, q.module, q.query, order_by, offset, fields,
[], max_results, int(deleted), int(favorites)]
results = self._request('get_entry_list', data)['entry_list']
ret = []
for result in results:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment