|
Revision 2549, 1.5 kB
(checked in by fperez, 3 years ago)
|
API cleanup and name changes.
|
| Line | |
|---|
| 1 |
import os |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
import tctst; reload(tctst) |
|---|
| 5 |
from tctst import * |
|---|
| 6 |
|
|---|
| 7 |
import ipythonconfig; reload(ipythonconfig) |
|---|
| 8 |
from ipythonconfig import IPythonConfig |
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
c2str = tconfig.configObj2Str |
|---|
| 12 |
|
|---|
| 13 |
f1 = 'tconfig1.conf' |
|---|
| 14 |
f2 = 'tconfig2.conf' |
|---|
| 15 |
c1 = mkConfigObj(f1) |
|---|
| 16 |
c2 = mkConfigObj(f2) |
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
cat(f1) |
|---|
| 20 |
cat(f2) |
|---|
| 21 |
print '><'*40 |
|---|
| 22 |
print c2str(c2) |
|---|
| 23 |
|
|---|
| 24 |
app1 = App(IPythonConfig,'tconfig1.conf') |
|---|
| 25 |
app2 = App(IPythonConfig,'tconfig2.conf') |
|---|
| 26 |
|
|---|
| 27 |
cr1 = RecursiveConfigObj('tconfig1.conf') |
|---|
| 28 |
os.system('cp tconfig2.conf tconfig2_copy.conf') |
|---|
| 29 |
cr2 = RecursiveConfigObj('tconfig2_copy.conf') |
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
print '^'*80 |
|---|
| 33 |
print c2str(cr1.conf) |
|---|
| 34 |
print '-'*80 |
|---|
| 35 |
print c2str(cr2.conf) |
|---|
| 36 |
|
|---|
| 37 |
ic1 = IPythonConfig(cr1.conf) |
|---|
| 38 |
ic2 = IPythonConfig(cr2.conf) |
|---|
| 39 |
print '^'*80 |
|---|
| 40 |
print ic2 |
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
print '^-'*40 |
|---|
| 44 |
cr2_fname = 'tconfig2_copy.conf' |
|---|
| 45 |
cr2 = TConfigManager(IPythonConfig,cr2_fname) |
|---|
| 46 |
print '^'*80 |
|---|
| 47 |
print 'Changing m' |
|---|
| 48 |
print 'm=',cr2.tconf.m |
|---|
| 49 |
cr2.tconf.m = 101 |
|---|
| 50 |
print 'm=',cr2.tconf.m |
|---|
| 51 |
|
|---|
| 52 |
print '^'*80 |
|---|
| 53 |
print 'Changing key' |
|---|
| 54 |
print 'key=',cr2.tconf.Protocol.Handler.key |
|---|
| 55 |
cr2.tconf.Protocol.Handler.key = "New Key" |
|---|
| 56 |
print 'key=',cr2.tconf.Protocol.Handler.key |
|---|
| 57 |
cr2.tconf.Protocol.Handler.key2 = "New Key2" |
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
cr2.tconf.select = 'these' |
|---|
| 61 |
cr2.tconf.Machine.ip = '99.88.77.66' |
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
print '---------------- BEFORE ------------------' |
|---|
| 65 |
cat(cr2_fname) |
|---|
| 66 |
print '++++++++++++++++ AFTER +++++++++++++++++++' |
|---|
| 67 |
cr2.write() |
|---|
| 68 |
cat(cr2_fname) |
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
print '^'*80 |
|---|
| 72 |
print ic2 |
|---|