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, is model change over 
time. If fairly easy to introduce model changes that causes old or new data 
to validate and then you know have to deal with schema/data migration.

T  


On Sunday, November 16, 2014 7:35:48 PM UTC+8, timh wrote:
>
> 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 <lap...@gmail.com> wrote:
>>>
>>> I tested this code 
>>> <https://gist.github.com/anonymous/18648c7134f41a6c1b74>. 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 writing custom 
>>> property for model useless at this point.
>>>
>>
>>
>>
>> I think you might be missing Tim's point. FirstModel will be validated, 
>> but the inner SecondModel isn't being validated - it's serialized directly 
>> as a property. You can see this because the pre-put and post-put hooks you 
>> defined for SecondModel aren't being run (at least, I don't see the correct 
>> log lines after line 64 in your Github gist).
>>
>> If you want SecondModel validated, try to put it directly as Tim 
>> attempted to do in his post (and received the correct error messages). 
>>
>> Now as for the larger question you asked in the OP, this might be 
>> something that should be clarified in documentation, but I don't think it's 
>> necessarily a bug. If you need this style of validation to work in your 
>> app, you can try explaining your use case and there may be workarounds we 
>> can try.
>>
>>
>> -----------------
>> -Vinny P
>> Technology & Media Consultant
>> Chicago, IL
>>
>> App Engine Code Samples: http://www.learntogoogleit.com
>>  
>>
>

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