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 3671606
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:30:27+00:00 2026-05-19T02:30:27+00:00

i am writing an app to compare products, using Python and GAE. The products

  • 0

i am writing an app to compare products, using Python and GAE. The products will belong to a set of similar products, and the app calculates the best value in each set.

When i create a new product, it can be added to an existing set or a new set can be created.

When testing the app, the first set gets created just fine. I populate an instance of the set with the name of the product. I use a form on one web page to POST the data into the “suppbook” page. I’m still not clear on how a web page can be a class but that’s a different question.

There’s more code around all of this but I’m trying to make my question as clear as possible.

class Supp(db.Model):
    name             = db.StringProperty(multiline=False)
    # a bunch of other attributes using Google's DB Model

class SuppSet(db.Model):
    name       = db.StringProperty(default='')
    supp_list  = set([])
    # a bunch of other attributes using Google's DB Model        

    # i tried to add this after reading a few questions on SO but GAE doesn't like it
    def __init__(self,):
       self.name       = 'NoName'
       self.best_value = 'NoBestValue'
       self.supp_list  = set([])

Class Suppbook(webapp.RequestHandler):
def post(self):
    supp             = Supp()
    suppSet          = SuppSet()
...
    supp.name          = self.request.get('name')
    supp.in_set        = self.request.get('newset')
    suppSet.name       = supp.in_set
    suppSet.supp_list.add(supp.name)
    self.response.out.write('%s now contains %s<p>' % (suppSet.name,suppSet.supp_list))

This works well the first time around, and if I only use one SuppSet, I can add many supps to it. If I create another SuppSet, though, both suppSets will have the same contents for their supp_list. I have been looking through the questions on here and I think (know) I’m doing something wrong regarding class vs. instance attribute access. I tried to create an __init__ method for SuppSet but GAE complained: AttributeError: ‘SuppSet’ object has no attribute ‘_entity’

Also, I am using the GAE datastore to put() and get() the Supps and SuppSets, so I’m not clear why I’m not acting on the unique instances that I should be pulling from the DB.

I am not sure if I am providing enough information but I wanted to get started on this issue. Please let me know if more info is needed to help debug this.

I’m also open to the idea that i’m going about this completely wrong. I’m considering re-writing the whole thing, but I’m so close to being “finished” with basic functionality that I’d like to try to solve this issue.

Thanks

  • 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-19T02:30:28+00:00Added an answer on May 19, 2026 at 2:30 am

    In your init you will need to call the super’s init, db.Model has some important stuff to do in its init, you will have to match the signature.

    However you likely shouldn’t be setting up things like defaults in there. Try and just use the datastore Properties ability to set a default.

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

Sidebar

Related Questions

I am writing an app for GAE (Python 2.5) and I was wondering if
I'm writing an app that will need to make use of Timer s, but
I'm writing an app using asp.net-mvc deploying to iis6. I'm using forms authentication. Usually
I'm writing an app where I want to compare two strings' size. By size,
I'm writing preferences for my app which registers it for launch at login (using
so i am writing an app for android which will push some data over
I'm writing a client app that's a bit similar to MS Excel - It
I'm writing an app to help facilitate some research, and part of this involves
I'm writing an app which for various reasons involves Internet Explorer (IE7, for the
I'm writing an app that contains the following tables: (1) employee_type, (2) employee and

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.