9 CONF_FILE
= os
.path
.join(urk
.userpath
,'urk.conf')
11 def pprint(obj
, depth
=-2):
16 if isinstance(obj
, dict):
21 string
.append('%s%s%s' % (' '*depth
, repr(key
), ': '))
22 string
+= pprint(obj
[key
], depth
)
24 string
.append('%s%s' % (' '*depth
, '},\n'))
27 string
.append('{},\n')
29 elif isinstance(obj
, list):
34 string
.append('%s' % (' '*depth
))
35 string
+= pprint(item
, depth
)
37 string
.append('%s%s' % (' '*depth
, '],\n'))
40 string
.append('[],\n')
43 string
.append('%s,\n' % (repr(obj
),))
48 return ''.join(string
)[:-2]
51 fd
, new_file
= tempfile
.mkstemp()
52 os
.chmod(new_file
,0600)
54 fd
= file(new_file
, "wb")
56 fd
.write(pprint(conf
))
58 shutil
.move(new_file
, CONF_FILE
)
62 events
.register('Exit', 'post', save
)
65 conf
= eval(file(CONF_FILE
, "U").read().strip())
72 if __name__
== '__main__':