I switched the GQL Query to the following.
Now the GQL Query no longer gives 500 severe error, but almost
anything I code after that does give the 500 severe error.
I need to test if I returned any rows or not, ideally one.
taskLogs = db.GqlQuery("SELECT * FROM TaskLog where taskCode = :
taskLogs is a db.GqlQuery. The only way it will be None is if the
db.GqlQuery() constructor fails horribly.
to count rows returned, use count().
On May 19, 4:05 pm, Neal wrote:
> I switched the GQL Query to the following.
> Now the GQL Query no longer gives 500 severe error, but almost
> anyth
But why would testing for None throw a 500 severe error? Seems like
it would catch the error and display something more helpful??
I am running with debug=True.
Thanks for the clue on "count", here's how I got the count working:
def get(self):
query = TaskLog.gql("WHERE resultFlag > 0");
Actually, on further testing, my count is still not working, always
seems to return 0.
TaskLogs is a list of TaskLog objects, right?
Neal
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
T
No, TaskLogs is (in the code snippet you pasted above), a GqlQuery
object. To get the list of results, you need to call .fetch(limit), or
.count(limit) if you just want a result count.
-Nick Johnson
On Thu, May 21, 2009 at 2:57 AM, Neal wrote:
>
> Actually, on further testing, my count is still
I did do a fetch into TaskLogs: TaskLogs = query.fetch
(LIMIT,offset=0);
My GQL query object is called "query", right?
In the template I do this: {%for TaskLog in TaskLogs%}.
So that implies to me that TaskLogs is a list, and if I can iterate
through it, I should be able to use the native Python C
Sorry, I was looking at the wrong snippet. 'count' is not a valid
method on a Python list object. Instead, use "len(TaskLogs)", or
better just "if TaskLogs", which evaluates to true if TaskLogs is
non-empty.
-Nick Johnson
On Thu, May 21, 2009 at 2:28 PM, Neal wrote:
>
> I did do a fetch into Ta