Although this does not directly answer your question, it gives some good
insight that may be benefitial to you.

Also, if you really want to have your custom constructor for validation,
what you could do is to write a wrapper around your db.Model, and of course
you can do whatever you want in your wrapper for the constructor.

Hope this helps.

Cheers.

On Wed, Aug 24, 2011 at 1:11 PM, Santiago Basulto <
[email protected]> wrote:

> Hello,
>
> i want to do some validation before my models start.
>
> Something like
>
> class NegativeDoorNumber(BaseException): pass
>
> class Car(db.Model):
>    doors = db.IntegerPropery(required=True,default=4)
>
>    def __init__(self,doors=4,**kwds):
>       if(doors<0):
>          raise NegativeDoorNumber("Hey, doors can't be negative")
>       db.Model.__init__(self,doors,kwds)
>
> This, of course doesn't work.
>
> Can you help me?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine/-/6IlkEdipQtYJ.
> 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.
>



-- 
Yanzheng Li
Technical Solutions Engineer
Partner Solutions Organization
Google Inc.

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