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 (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, the second won't 
> define a value for the property.
>
> You can see this also in the how indexes work, the former will have a 
> value in the index, the later won't even have a record in the index for 
> some_other_prop
>
> So in my opinion it isn't a bug, but could probably do with more explicit 
> documentation.
>
> Just my 2c 
>
> Cheers
>
> T
>
> On Friday, October 24, 2014 9:04:13 PM UTC+8, Lapteuh wrote:
>>
>> Hello. Noticed a strange behavior in the library ndb. In my opinion it 
>> looks like a bug.
>>
>> Example:
>>
>> class SecondModel(ndb.Model):
>>     important_prop = ndb.StringProperty(required=True)
>>
>>
>> class FirstModel(ndb.Model):
>>     some_prop = ndb.StringProperty()
>>
>>     some_other_prop = ndb.StructuredProperty(SecondModel, required=True)
>>     
>>     
>> def some_func():
>>
>>     buggy = None # attention here
>>
>>     model2 = SecondModel(important_prop=buggy)
>>     model1 = FirstModel(some_other_prop=model2)
>>     model1.put()
>>     return 
>>
>>
>> Despite the fact that the code does not need to work, he works. No 
>> exception! '*required*' option in property '*important_prop*' from '
>> *SecondModel*' just ignored.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/d/optout.

Reply via email to