Types in Python - Google Appengine
- by Chris M
Getting a bit peeved now;
I have a model and a class thats just storing a get request in the database; basic tracking.
class SearchRec(db.Model):
WebSite = db.StringProperty()#required=True
WebPage = db.StringProperty()
CountryNM = db.StringProperty()
PrefMailing = db.BooleanProperty()
DateStamp = db.DateTimeProperty(auto_now_add=True)
IP = db.StringProperty()
class AddSearch(webapp.RequestHandler):
def get(self):
searchRec = SearchRec()
searchRec.WebSite = self.request.get('WEBSITE')
searchRec.WebPage = self.request.get('WEBPAGE')
searchRec.CountryNM = self.request.get('COUNTRY')
searchRec.PrefMailing = bool(self.request.get('MAIL'))
searchRec.IP = self.request.get('IP')
Bool has my biscuit; I thought that setting bool(self.reque....) would set the type of the string but no matter what I pass it it still stores it as TRUE in the database.
I had the same issue with using required=True on strings for the model; the damn thing kept saying that nothing was being passed... but it had.
Ta