displaying a message in case of non-existent field name for the search function of stacky server

This commit is contained in:
Manali Latkar 2013-09-16 16:50:53 +05:30
parent 8de2daf8d9
commit c2a76faeb9

View File

@ -600,5 +600,8 @@ def search(request):
routing_key_status = routing_key_type(event.routing_key)
results = event.search_results(results, when, routing_key_status)
return rsp(json.dumps(results))
except ObjectDoesNotExist or FieldError:
return rsp([])
except ObjectDoesNotExist:
return rsp(["The requested object does not exist"])
except FieldError:
return rsp(["The requested field '%s' does not exist for the corresponding object.\n"
"Note: The field names of database are case-sensitive." % field] )