##// END OF EJS Templates
DOC: Warn the user when they pass `default` to a TraitType....
Scott Sanderson -
Show More
@@ -51,6 +51,7 b' try:'
51 ClassTypes = (ClassType, type)
51 ClassTypes = (ClassType, type)
52 except:
52 except:
53 ClassTypes = (type,)
53 ClassTypes = (type,)
54 from warnings import warn
54
55
55 from .importstring import import_item
56 from .importstring import import_item
56 from IPython.utils import py3compat
57 from IPython.utils import py3compat
@@ -330,6 +331,13 b' class TraitType(object):'
330 if allow_none is not None:
331 if allow_none is not None:
331 self.allow_none = allow_none
332 self.allow_none = allow_none
332
333
334 if 'default' in metadata:
335 # Warn the user that they probably meant default_value.
336 warn(
337 "Parameter 'default' passed to TraitType. "
338 "Did you mean 'default_value'?"
339 )
340
333 if len(metadata) > 0:
341 if len(metadata) > 0:
334 if len(self.metadata) > 0:
342 if len(self.metadata) > 0:
335 self._metadata = self.metadata.copy()
343 self._metadata = self.metadata.copy()
General Comments 0
You need to be logged in to leave comments. Login now