Damn! This is a real embarrassment for me. Good thing my full name does not appear in this email!
Thanks djidjadji! On 8 avr, 17:48, djidjadji <[email protected]> wrote: > > c = Greeting.count + 1 > > TypeError: unsupported operand type(s) for +=: 'IntegerProperty' > > and 'int' > > Inside a method of the Greeting class you don't reference the count > property with the class name but with 'self'. > If you use Greeting.count you are using the class variable 'count' not > the instance property 'count'. > > class Greeting(db.Model): > count = db.IntegerProperty(required=True) > > def myMethod(self): > c = self.count + 1 > > 2009/4/8 Mel T. <[email protected]>: > > > > > Hi, > > > I come from another language and framework world, thus I am new to > > python and gae so please excuse my ignorance. > > > I get this error when I call a method I added to a db.Model derived > > class: > > > c = Greeting.count + 1 > > TypeError: unsupported operand type(s) for +=: 'IntegerProperty' > > and 'int' > > > To reproduce that, I simplified my problem to modifying the HelloWorld > > Greetings application. I added this to the Greetings class: > > > # add a count property to the model > > count = db.IntegerProperty(required=True) > > > # add a function that uses the count > > def inc_count(self): > > c = Greeting.count + 1 > > > Then, in the sample code further down, in the class Guestbook, > > function post(self), I replaced the first line (instantiation of a > > Greeting) with this: > > > greeting = Greeting(count=4) > > greeting.inc_count() > > > The call to greeting.inc_count() causes the error pasted above. Why is > > that? > > > -- > > Mel T. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
