Re: [google-appengine] Re: Bug in ndb with StructuredProperty?

2014-11-16 Thread timh
Though to be honest I would probably not do it at put time, but deal with the validation at input validation stage, If you leave things for validation at the time of put() it's usually a lot harder to inform the enduser in forms based messages. The other problem with strict validation on models,

Re: [google-appengine] Re: Bug in ndb with StructuredProperty?

2014-11-16 Thread timh
One possible approach for the inner SecondModel validation would be to call _validate explicitly on it, . You could call this from a _pre_put hook defined on FirstModel T On Monday, November 10, 2014 1:33:17 PM UTC+8, Vinny P wrote: > > On Sat, Nov 8, 2014 at 7:44 AM, Lapteuh > > wrote: >> >>

Re: [google-appengine] Re: Bug in ndb with StructuredProperty?

2014-11-09 Thread Vinny P
On Sat, Nov 8, 2014 at 7:44 AM, Lapteuh wrote: > > I tested this code > . First again, > *required* parameter ignored, but it must be composable (It is written in > the documentation). Second, *validation* in *StructuredProperty* work > only

[google-appengine] Re: Bug in ndb with StructuredProperty?

2014-11-08 Thread Lapteuh
Hi. I tested this code . First again, *required* parameter ignored, but it must be composable (It is written in the documentation). Second, *validation* in *StructuredProperty* work only on *not None* value and it's second bug, because wri

[google-appengine] Re: Bug in ndb with StructuredProperty?

2014-11-04 Thread timh
Hi You are correct, s~cash-drawer> class SecondModel(ndb.Model): ... important_prop = ndb.StringProperty(required=True) ... s~cash-drawer> class FirstModel(ndb.Model): ... some_prop = ndb.StringProperty() ... some_other_prop = ndb.StructuredProperty(SecondModel, required=True) ... s

[google-appengine] Re: Bug in ndb with StructuredProperty?

2014-11-04 Thread Lapteuh
I tested SecondModel() without parameters and result is same. Still no error. вторник, 4 ноября 2014 г., 19:11:40 UTC+5 пользователь timh написал: > > Not sure I would interpret it as a bug > > If you do model2 = SecondModel() > > You would get the error you expect.. > > Setting a property (espec

[google-appengine] Re: Bug in ndb with StructuredProperty?

2014-11-04 Thread timh
Not sure I would interpret it as a bug If you do model2 = SecondModel() You would get the error you expect.. Setting a property (especiallya StringProperty) explicitly to None, is not the same as not setting the value of the property. The former will define the Property with a value of None, th

[google-appengine] Re: Bug in ndb with StructuredProperty?

2014-10-24 Thread Mihail Russu
Once you do model2.put() the exception will be raised as expected. There is no validation prior to attempting to store the data in datastore unless you'd like to manually create it. I.e. to get the error you were looking for try the following code: class SecondModel(ndb.Model): important_p