Hi Kelly,

It is possible to provide a constructor, but not recommended. If you do,
make sure to take arbitrary arguments (*args, **kwargs) and pass them to the
parent constructor, and bear in mind that the constructor will be called
internally when constructing instances restored from the datastore, as well
as when you call it explicitly.

In general, though, factory methods are a safer option.

-Nick Johnson

On Sat, Apr 10, 2010 at 5:10 PM, Kelly A <[email protected]> wrote:

> As I understand it you cannot use python constructors when creating an
> object that inherits from db.model, so this would not work:
>
> class myClass(db.model):
>  myProperty = db.StringProperty()
>  def __init__(self):
>     tempProperty = something complex.
>     myProperty = tempProperty
>
>
> Is the best way to do processing on the creation of objects based on
> db.model to create factories that generate the objects then?
>
> --
> 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]<google-appengine%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>


-- 
Nick Johnson, Developer Programs Engineer, App Engine Google Ireland Ltd. ::
Registered in Dublin, Ireland, Registration Number: 368047
Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number:
368047

-- 
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.

Reply via email to