I'm trying to retrieve an entry from Google App Engine's datastore using the filter()
method as follows:
result = Sender.all().filter("email =", email).filter("source_address =", source).filter("dest_address =", dest).filter("food_type =", food_type)
Then, if such an entry exists, I change the value of one of the columns in that entry. Otherwise, I'm displaying an error message.
if result:
for e in result:
e.time_of_delivery = toj
e.put()
self.response.write("Time of delivery successfully rescheduled !")
else:
self.response.write("No such request.")
However, even when an entry in the datastore doesn't exist based on the conditions imposed by the filter()
methods that I have used, the No such request.
message is never displayed. Instead, all I get is a blank page.
What exactly is wrong with my code? Why is the else
part of my code never executed when an entry is not found in the datastore, i.e when result = None
?