@xmlrpc_method()
-def project_list(search_str='', max_count=0):
+def project_list(search_str=None, max_count=0):
"""List projects matching a given linkname filter.
Filter projects by linkname. Projects are compared to the search
of all projects if no filter given.
"""
try:
- if len(search_str) > 0:
+ if search_str:
projects = Project.objects.filter(linkname__icontains=search_str)
else:
projects = Project.objects.all()
@xmlrpc_method()
-def person_list(search_str="", max_count=0):
+def person_list(search_str=None, max_count=0):
"""List persons matching a given name or email filter.
Filter persons by name and email. Persons are compared to the
of all persons if no filter given.
"""
try:
- if len(search_str) > 0:
+ if search_str:
people = (Person.objects.filter(name__icontains=search_str) |
Person.objects.filter(email__icontains=search_str))
else:
@xmlrpc_method()
-def state_list(search_str='', max_count=0):
+def state_list(search_str=None, max_count=0):
"""List states matching a given name filter.
Filter states by name. States are compared to the search string
of all states if no filter given.
"""
try:
- if len(search_str) > 0:
+ if search_str:
states = State.objects.filter(name__icontains=search_str)
else:
states = State.objects.all()