Show More
@@ -24,6 +24,7 b' from IPython.utils.warn import error' | |||
|
24 | 24 | # Magic implementation classes |
|
25 | 25 | #----------------------------------------------------------------------------- |
|
26 | 26 | |
|
27 | reg = re.compile('^\w+\.\w+$') | |
|
27 | 28 | @magics_class |
|
28 | 29 | class ConfigMagics(Magics): |
|
29 | 30 | |
@@ -129,9 +130,21 b' class ConfigMagics(Magics):' | |||
|
129 | 130 | help = re.sub(re.compile(r'^--', re.MULTILINE), '', help) |
|
130 | 131 | print help |
|
131 | 132 | return |
|
133 | elif reg.match(line): | |
|
134 | cls, attr = line.split('.') | |
|
135 | return getattr(configurables[classnames.index(cls)],attr) | |
|
132 | 136 | elif '=' not in line: |
|
133 | raise UsageError("Invalid config statement: %r, " | |
|
134 | "should be Class.trait = value" % line) | |
|
137 | extra = '' | |
|
138 | lcname = map(str.lower,classnames) | |
|
139 | ll = line.lower() | |
|
140 | if ll in lcname: | |
|
141 | correctname = classnames[lcname.index(ll) ] | |
|
142 | extra = '\nDid you mean '+correctname+' (Difference in Case)' | |
|
143 | msg = "Invalid config statement: %r, "\ | |
|
144 | "should be `Class.trait = value`." | |
|
145 | ||
|
146 | msg = msg+extra | |
|
147 | raise UsageError( msg % line) | |
|
135 | 148 | |
|
136 | 149 | # otherwise, assume we are setting configurables. |
|
137 | 150 | # leave quotes on args when splitting, because we want |
General Comments 0
You need to be logged in to leave comments.
Login now