You may want to look at get_value_for_datastore here: http://code.google.com/appengine/articles/extending_models.html
This gets called in the course of a put, and can be used to accomplish other actions as well. On Mar 13, 5:06 am, "Michael O'Brien" <mich...@mcobrien.org> wrote: > If you want to add something to __init__, you can do something like > this: > > class A(BaseModel): > def __init__(self, *args, **kwargs): > # do something here, e.g. adding values to kwargs (property > values) > kwargs["canonical_name"] = kwargs["name"].lower().strip() > super(A, self).__init__(*args, **kwargs) > > cheers > Michael > > On Mar 13, 4:45 am, yucc <yucc2...@gmail.com> wrote: > > > Hi all, > > I want to overwrite the default save method of the > > google.appengine.ext.db.Model so as to perform some special work each > > time the entity save(or update),I know in Django model this should be > > like this:(in the model definition) > > def save(self, force_insert=False, force_update=False): > > self.level = self.level+1 #I want to let the level property > > auto add > > super(User, self).save(force_insert, force_update) # Call the > > "real" save() method. > > #do_something_else() > > > But, this doesn't work with google.appengine.ext.db.Model,it comes out > > that the Model's put method takes exactly 1 argument,so I omit > > them,like this: > > super(User, self).save(), > > Is that right? > > I was wondering how to construct a Model,as there's a init method: > > def __init__(self, parent=None, key_name=None, _app=None, > > _from_entity=False, **kwds) > > It seems "super(User, self)" is not right here > > Anyone could help ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---