Fixed #16383 -- Raised the AttributeError raised in property of an object when used in a template.

Thanks Hiroki and Tim Graham for review.