[google-appengine] Re: Setting up an Initialiser

2009-01-16 Thread Qian Qiao
On Sat, Jan 17, 2009 at 00:02, eli elliott.rosent...@gmail.com wrote: Hi, I cant complete something seemingly very simple. I simply want to create the following object (Auction) auction =Auction(title, desc) class Auction(db.Model): title = db.StringProperty() description =

[google-appengine] Re: Setting up an Initialiser

2009-01-16 Thread djidjadji
If you look at the example at http://code.google.com/appengine/docs/python/gettingstarted/usingdatastore.html you see that you don't write an __init__() method if you subclass from db.Model or db.Expando. db.Model.__init__() will take care of assigning the correct attributes.

[google-appengine] Re: Setting up an Initialiser

2009-01-16 Thread Elliott Rosenthal
What about if I wish to initialise the variables inside the class with a complex calculation? The default parameter wont suffice, is there any other way? 2009/1/16 djidjadji djidja...@gmail.com: If you look at the example at

[google-appengine] Re: Setting up an Initialiser

2009-01-16 Thread Qian Qiao
On Sat, Jan 17, 2009 at 01:49, Elliott Rosenthal elliott.rosent...@gmail.com wrote: What about if I wish to initialise the variables inside the class with a complex calculation? The default parameter wont suffice, is there any other way? Define a factory method that builds the model? -- Joe

[google-appengine] Re: Setting up an Initialiser

2009-01-16 Thread Elliott Rosenthal
Thank you for the help so far, it really has been useful. If there any way you could give me a quick snippet of code to show me how to build a factory method? 2009/1/16 Qian Qiao qian.q...@gmail.com: On Sat, Jan 17, 2009 at 01:49, Elliott Rosenthal elliott.rosent...@gmail.com wrote: What

[google-appengine] Re: Setting up an Initialiser

2009-01-16 Thread Qian Qiao
On Sat, Jan 17, 2009 at 02:02, Elliott Rosenthal elliott.rosent...@gmail.com wrote: Thank you for the help so far, it really has been useful. If there any way you could give me a quick snippet of code to show me how to build a factory method? Let's say we have a model that models a circle,

[google-appengine] Re: Setting up an Initialiser

2009-01-16 Thread Elliott Rosenthal
Yes of course! :) Thank you for the help. Saved me a lot of sweat. 2009/1/16 Qian Qiao qian.q...@gmail.com: On Sat, Jan 17, 2009 at 02:02, Elliott Rosenthal elliott.rosent...@gmail.com wrote: Thank you for the help so far, it really has been useful. If there any way you could give me a

[google-appengine] Re: Setting up an Initialiser

2009-01-16 Thread Andy Freeman
class Auction(db.Model): title = db.StringProperty() description = db.StringProperty() def __init__(self, title, desc): self.title = title self.desc = desc This code is trimmed down from the full version, could you tell me if im doing anything