##// END OF EJS Templates
Update config docs so they don't refer to Str traitlet type.
Thomas Kluyver -
Show More
@@ -126,7 +126,7 b' subclass::'
126 126
127 127 # Sample component that can be configured.
128 128 from IPython.config.configurable import Configurable
129 from IPython.utils.traitlets import Int, Float, Str, Bool
129 from IPython.utils.traitlets import Int, Float, Unicode, Bool
130 130
131 131 class MyClass(Configurable):
132 132 name = Unicode(u'defaultname', config=True)
@@ -150,8 +150,8 b' After this configuration file is loaded, the values set in it will override'
150 150 the class defaults anytime a :class:`MyClass` is created. Furthermore,
151 151 these attributes will be type checked and validated anytime they are set.
152 152 This type checking is handled by the :mod:`IPython.utils.traitlets` module,
153 which provides the :class:`Str`, :class:`Int` and :class:`Float` types. In
154 addition to these traitlets, the :mod:`IPython.utils.traitlets` provides
153 which provides the :class:`Unicode`, :class:`Int` and :class:`Float` types.
154 In addition to these traitlets, the :mod:`IPython.utils.traitlets` provides
155 155 traitlets for a number of other types.
156 156
157 157 .. note::
@@ -237,14 +237,14 b' Sometimes, your classes will have an inheritance hierarchy that you want'
237 237 to be reflected in the configuration system. Here is a simple example::
238 238
239 239 from IPython.config.configurable import Configurable
240 from IPython.utils.traitlets import Int, Float, Str, Bool
240 from IPython.utils.traitlets import Int, Float, Unicode, Bool
241 241
242 242 class Foo(Configurable):
243 name = Str('fooname', config=True)
243 name = Unicode(u'fooname', config=True)
244 244 value = Float(100.0, config=True)
245 245
246 246 class Bar(Foo):
247 name = Str('barname', config=True)
247 name = Unicode(u'barname', config=True)
248 248 othervalue = Int(0, config=True)
249 249
250 250 Now, we can create a configuration file to configure instances of :class:`Foo`
@@ -253,7 +253,7 b' and :class:`Bar`::'
253 253 # config file
254 254 c = get_config()
255 255
256 c.Foo.name = 'bestname'
256 c.Foo.name = u'bestname'
257 257 c.Bar.othervalue = 10
258 258
259 259 This class hierarchy and configuration file accomplishes the following:
@@ -460,7 +460,7 b' Here are the main requirements we wanted our configuration system to have:'
460 460 hierarchical data structures, namely regular attribute access
461 461 (``Foo.Bar.Bam.name``). Third, using Python makes it easy for users to
462 462 import configuration attributes from one configuration file to another.
463 Forth, even though Python is dynamically typed, it does have types that can
463 Fourth, even though Python is dynamically typed, it does have types that can
464 464 be checked at runtime. Thus, a ``1`` in a config file is the integer '1',
465 465 while a ``'1'`` is a string.
466 466
General Comments 0
You need to be logged in to leave comments. Login now