Show More
@@ -24,6 +24,7 b' from IPython.utils.warn import error' | |||||
24 | # Magic implementation classes |
|
24 | # Magic implementation classes | |
25 | #----------------------------------------------------------------------------- |
|
25 | #----------------------------------------------------------------------------- | |
26 |
|
26 | |||
|
27 | reg = re.compile('^\w+\.\w+$') | |||
27 | @magics_class |
|
28 | @magics_class | |
28 | class ConfigMagics(Magics): |
|
29 | class ConfigMagics(Magics): | |
29 |
|
30 | |||
@@ -129,9 +130,21 b' class ConfigMagics(Magics):' | |||||
129 | help = re.sub(re.compile(r'^--', re.MULTILINE), '', help) |
|
130 | help = re.sub(re.compile(r'^--', re.MULTILINE), '', help) | |
130 | print help |
|
131 | print help | |
131 | return |
|
132 | return | |
|
133 | elif reg.match(line): | |||
|
134 | cls, attr = line.split('.') | |||
|
135 | return getattr(configurables[classnames.index(cls)],attr) | |||
132 | elif '=' not in line: |
|
136 | elif '=' not in line: | |
133 | raise UsageError("Invalid config statement: %r, " |
|
137 | extra = '' | |
134 | "should be Class.trait = value" % line) |
|
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 | # otherwise, assume we are setting configurables. |
|
149 | # otherwise, assume we are setting configurables. | |
137 | # leave quotes on args when splitting, because we want |
|
150 | # leave quotes on args when splitting, because we want |
General Comments 0
You need to be logged in to leave comments.
Login now