##// 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 # Sample component that can be configured.
127 # Sample component that can be configured.
128 from IPython.config.configurable import Configurable
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 class MyClass(Configurable):
131 class MyClass(Configurable):
132 name = Unicode(u'defaultname', config=True)
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 the class defaults anytime a :class:`MyClass` is created. Furthermore,
150 the class defaults anytime a :class:`MyClass` is created. Furthermore,
151 these attributes will be type checked and validated anytime they are set.
151 these attributes will be type checked and validated anytime they are set.
152 This type checking is handled by the :mod:`IPython.utils.traitlets` module,
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
153 which provides the :class:`Unicode`, :class:`Int` and :class:`Float` types.
154 addition to these traitlets, the :mod:`IPython.utils.traitlets` provides
154 In addition to these traitlets, the :mod:`IPython.utils.traitlets` provides
155 traitlets for a number of other types.
155 traitlets for a number of other types.
156
156
157 .. note::
157 .. note::
@@ -237,14 +237,14 b' Sometimes, your classes will have an inheritance hierarchy that you want'
237 to be reflected in the configuration system. Here is a simple example::
237 to be reflected in the configuration system. Here is a simple example::
238
238
239 from IPython.config.configurable import Configurable
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 class Foo(Configurable):
242 class Foo(Configurable):
243 name = Str('fooname', config=True)
243 name = Unicode(u'fooname', config=True)
244 value = Float(100.0, config=True)
244 value = Float(100.0, config=True)
245
245
246 class Bar(Foo):
246 class Bar(Foo):
247 name = Str('barname', config=True)
247 name = Unicode(u'barname', config=True)
248 othervalue = Int(0, config=True)
248 othervalue = Int(0, config=True)
249
249
250 Now, we can create a configuration file to configure instances of :class:`Foo`
250 Now, we can create a configuration file to configure instances of :class:`Foo`
@@ -253,7 +253,7 b' and :class:`Bar`::'
253 # config file
253 # config file
254 c = get_config()
254 c = get_config()
255
255
256 c.Foo.name = 'bestname'
256 c.Foo.name = u'bestname'
257 c.Bar.othervalue = 10
257 c.Bar.othervalue = 10
258
258
259 This class hierarchy and configuration file accomplishes the following:
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 hierarchical data structures, namely regular attribute access
460 hierarchical data structures, namely regular attribute access
461 (``Foo.Bar.Bam.name``). Third, using Python makes it easy for users to
461 (``Foo.Bar.Bam.name``). Third, using Python makes it easy for users to
462 import configuration attributes from one configuration file to another.
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 be checked at runtime. Thus, a ``1`` in a config file is the integer '1',
464 be checked at runtime. Thus, a ``1`` in a config file is the integer '1',
465 while a ``'1'`` is a string.
465 while a ``'1'`` is a string.
466
466
General Comments 0
You need to be logged in to leave comments. Login now