##// END OF EJS Templates
Added handling of multiple args to store -r and removed error message
Michael Shuffett -
Show More
@@ -100,8 +100,8 b' class StoreMagics(Magics):'
100 * ``%store -z`` - Remove all variables from storage
100 * ``%store -z`` - Remove all variables from storage
101 * ``%store -r`` - Refresh all variables from store (delete
101 * ``%store -r`` - Refresh all variables from store (delete
102 current vals)
102 current vals)
103 * ``%store -r spam`` - Refresh specified variable from store (delete
103 * ``%store -r spam bar`` - Refresh specified variables from store
104 current val)
104 (delete current val)
105 * ``%store foo >a.txt`` - Store value of foo to new file a.txt
105 * ``%store foo >a.txt`` - Store value of foo to new file a.txt
106 * ``%store foo >>a.txt`` - Append value of foo to file a.txt
106 * ``%store foo >>a.txt`` - Append value of foo to file a.txt
107
107
@@ -136,13 +136,13 b' class StoreMagics(Magics):'
136
136
137 elif 'r' in opts:
137 elif 'r' in opts:
138 if args:
138 if args:
139 for arg in args:
139 try:
140 try:
140 obj = db['autorestore/' + args[0]]
141 obj = db['autorestore/' + arg]
141 except KeyError:
142 except KeyError:
142 print "Unable to restore variable '%s', (use %%store -d to forget!)" % args[0]
143 print "no stored variable %s" % arg
143 print "The error was:", sys.exc_info()[0]
144 else:
144 else:
145 ip.user_ns[args[0]] = obj
145 ip.user_ns[arg] = obj
146 else:
146 else:
147 refresh_variables(ip)
147 refresh_variables(ip)
148
148
General Comments 0
You need to be logged in to leave comments. Login now