Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 711659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:45:37+00:00 2026-05-14T04:45:37+00:00

Getting a bit peeved now; I have a model and a class thats just

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:45:38+00:00Added an answer on May 14, 2026 at 4:45 am

    You’ve added a lot of layers of complication to understanding what the bool() build-in function does. Why don’t you test it out directly on the command-line, before embedding it deep in your google app engine code.

    What you’d discover is that the bool() function uses python’s truth values:

    http://docs.python.org/library/stdtypes.html#truth-value-testing

    The following values are considered
    false:

    * None
    * False
    * zero of any numeric type, for example, 0, 0L, 0.0, 0j.
    * any empty sequence, for example, '', (), [].
    * any empty mapping, for example, {}.
    * instances of user-defined classes, if the class defines a
       `__nonzero__()` or `__len__()` method, when that method returns the integer
       zero or bool value False. [1]
    

    All other values are considered true —
    so objects of many types are always
    true.

    In particular – any non-empty string is True.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Access database project that is getting a bit to large to
I'm perhaps being a bit lazy asking this here, but I'm just getting started
I'm getting a bit tired of having to code explicitly for multicore if I
Possible Duplicate: JavaScript data formatting/pretty printer I am getting a bit tired of looking
I am getting back into a bit more .NET after a few-years of not
Ok, so I'm looking for a bit of architecture guidance, my team is getting
Just getting my head around Ruby metaprogramming. The mixin/modules always manage to confuse me.
Oh the joys of being a memory management noob ! I'm getting bit by
I am getting a bit confused here. In our application we are having a
I'm getting a bit more seasoned with my iPhone development but I still don't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.