would a PreCallHook works for your case?

http://code.google.com/appengine/articles/hooks.html

- eric

2010/1/14 Nickolas Daskalou <n...@daskalou.com>:
> I have a property of a Model that is a hash of another property of the same
> Model, eg:
>
> class MyModel(db.Model):
>   something = db.StringProperty()
>   something_hash = db.StringProperty()
>   def generate_hash(self):
>     self.something_hash = sha1(self.something)
>
> I want generate_hash() to be automatically called just before the entity is
> put() into the Datastore, without the developer having to explicitly call
> entity.generate_hash().
>
> I know I can create a put() method that makes such a call and then calls
> put() on the superclass, but (a) is that the best way to do it, and (b) if
> the put() is part of a batch put (eg. via db.put(entities)), will the put()
> method of each model instance still be called?
>
> Nick
>
> --
> 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-appeng...@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.
>
>
-- 
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-appeng...@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.


Reply via email to