List comprehensions can be useful in certain situations, but they can also be rather horrible to read.. As a slightly exaggerated example, how would you indent the following?
You should not use a list comprehension for that.
List comprehensions are an awesome feature, but they are meant to be shortcuts, not regular code.
For such a long snippet, you should use ordinary blocs :
allUuids = []
for x in self.db.query(schema.allPostsUuid).execute(timeout = 20) :
if x.type == "post" and x.deleted is not False :
allUuids.append(x.id)
Exactly the same behavior, much more readable. Guido would be proud of you :-)