git://git.onelab.eu
/
myplc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added a verify() routine to the PLCConfiguration object in order to enforce
[myplc.git]
/
plc-config-tty
diff --git
a/plc-config-tty
b/plc-config-tty
index
67ebe61
..
1e45cdc
100755
(executable)
--- a/
plc-config-tty
+++ b/
plc-config-tty
@@
-18,6
+18,7
@@
import readline
import getopt
from plc_config import PLCConfiguration
import getopt
from plc_config import PLCConfiguration
+from plc_config import ConfigurationException
####################
release_id = "$Id$"
####################
release_id = "$Id$"
@@
-360,8
+361,14
@@
def mainloop (cdef, cread, cwrite, default_config, site_config, consolidated_con
return
elif (command in "wW"):
try:
return
elif (command in "wW"):
try:
+ # Confirm that various constraints are met before saving file.
+ cwrite.verify(cdef, cread)
cwrite.save(site_config)
cwrite.save(site_config)
+ except ConfigurationException, e:
+ print "Save failed due to a configuration exception: %s" % e
+ break;
except:
except:
+ import traceback; print traceback.print_exc()
print ("Could not save -- fix write access on %s" % site_config)
break
print ("Wrote %s" % site_config)
print ("Could not save -- fix write access on %s" % site_config)
break
print ("Wrote %s" % site_config)