##// END OF EJS Templates
store dhist persistently in db
vivainio -
Show More
@@ -37,12 +37,16 b' def refresh_variables(ip):'
37 37 #print "restored",justkey,"=",obj #dbg
38 38 ip.user_ns[justkey] = obj
39 39
40
41 40
41 def restore_dhist(ip):
42 db = ip.db
43 ip.user_ns['_dh'] = db.get('dhist',[])
44
42 45 def restore_data(self):
43 46 ip = self.getapi()
44 47 refresh_variables(ip)
45 48 restore_aliases(self)
49 restore_dhist(self)
46 50 raise IPython.ipapi.TryNext
47 51
48 52 ip.set_hook('late_startup_hook', restore_data)
@@ -1,7 +1,7 b''
1 1 # -*- coding: utf-8 -*-
2 2 """Magic functions for InteractiveShell.
3 3
4 $Id: Magic.py 2406 2007-05-28 15:31:36Z vivainio $"""
4 $Id: Magic.py 2423 2007-06-11 16:47:22Z vivainio $"""
5 5
6 6 #*****************************************************************************
7 7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
@@ -2468,7 +2468,10 b' Defaulting color scheme to \'NoColor\'"""'
2468 2468 os.chdir(self.shell.home_dir)
2469 2469 if self.shell.rc.term_title:
2470 2470 platutils.set_term_title("IPy:~")
2471 self.shell.user_ns['_dh'].append(os.getcwd())
2471 cwd = os.getcwd()
2472 dhist = self.shell.user_ns['_dh']
2473 dhist.append(cwd)
2474 self.db['dhist'] = dhist[-50:]
2472 2475 if not 'q' in opts:
2473 2476 print self.shell.user_ns['_dh'][-1]
2474 2477
@@ -6,7 +6,7 b' Requires Python 2.3 or newer.'
6 6
7 7 This file contains all the classes and helper functions specific to IPython.
8 8
9 $Id: iplib.py 2422 2007-06-11 15:16:45Z vivainio $
9 $Id: iplib.py 2423 2007-06-11 16:47:22Z vivainio $
10 10 """
11 11
12 12 #*****************************************************************************
@@ -1202,7 +1202,6 b' want to merge them back into the new files.""" % locals()'
1202 1202 except OSError:
1203 1203 pass
1204 1204
1205 # save the "persistent data" catch-all dictionary
1206 1205 self.hooks.shutdown_hook()
1207 1206
1208 1207 def savehist(self):
General Comments 0
You need to be logged in to leave comments. Login now