Validate new blocks during copy

It is possible that a block is copied prior to validation, in which case
some fields (like when) which should be something other than a string might
not be. Using validate() in copy() is relatively harmless and ensures the
blocks are in the proper structure.

This also cleans up some of the finalized logic from an earlier commit and
adds similar logic for validated.

Fixes #17018
This commit is contained in:
James Cammarata
2016-08-10 06:59:30 -05:00
parent 543f266801
commit 57fca2dde2
2 changed files with 26 additions and 19 deletions

View File

@@ -192,6 +192,7 @@ class Block(Base, Become, Conditional, Taggable):
if self._role:
new_me._role = self._role
new_me.validate()
return new_me
def serialize(self):