attribute defaults that are containers are a copy

This is simpler way to prevent persistent containers across instances
of classes that use field attributes
pull/16807/head
Brian Coca 9 years ago
parent 2bfb13bfb3
commit ae2447df91

@ -19,6 +19,7 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from copy import deepcopy
class Attribute:
@ -32,6 +33,11 @@ class Attribute:
self.priority = priority
self.always_post_validate = always_post_validate
if default is not None and self.isa in ('list', 'dict', 'set'):
self.default = deepcopy(default)
else:
self.default = default
def __eq__(self, other):
return other.priority == self.priority

Loading…
Cancel
Save