the 2 filtered fields would actually be a unique index in sql so i want to see if an entity exists based on these 2 fields before inserting a new one.
currently i have:
t2get = db.GqlQuery("SELECT __key__ FROM Talk2 WHERE ccc = :1 AND ms = :2", c, theDay)
for x in t2get:
theKey = x[0]
if theKey:
t2 = Talk2.get(theKey)
else:
t2 = Talk2()
which errors with:
UnboundLocalError: local variable 'theKey' referenced before assignment
if the entity doens't exist.
Any ideas?