I want to check if the email is in my database in Appengine, and if not: then enter it in the data store.
I am new to python.
Why does this simple code not work? (Also, if there is a better way / more efficient way to write this, tell me)
(I get the error: BadArgumentError: unused positional arguments [1])
class EmailAdd(webapp.RequestHandler):
def get(self):
query = db.GqlQuery("SELECT * FROM EmailDatabase WHERE emailaddress=':1'", self.request.get('emailaddress'))
result = query.get()
if result is None:
newemail = EmailDatabase()
newemail.emailaddress = self.request.get('emailaddress')
newemail.put()
And for reference, this is my db class:
class EmailDatabase(db.Model):
emailaddress = db.StringProperty()
date = db.DateTimeProperty(auto_now_add=True)
chris source
share